summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/nl_parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* netlist: Relicensing of the GPL code to BSD-3 with the blessing of the Olivier Galibert2021-03-091-1/+1
| | | | | | | | | | copyright owners. Much thanks for that Couriersud, the main creator and contributor, but also to Jonathan Gevaryahu and Sergey Svishchev. There are small remnants in machine/NL_*, specifially breakout, pong doubles and rebound that are also copyrighted by the DICE team, whoever that means. They're not critical since they only concern these drivers and not an important core subsystem.
* netlist: optimize headers. couriersud2020-09-171-0/+22
| | | | * where possible rely on forward declarations to optimiuze compile time.
* netlist: Move selected NET_MODELS into the core couriersud2020-09-121-2/+2
|
* netlist: move to generated header and link support files files. couriersud2020-09-121-13/+22
| | | | | | | | | | | | | * Removed device and macro header files. * All of those can be generated automatically so going forward there is no need for these any longer. * Introduced the modules concept. Modules are netlists for which automatic lib entries are generated. * Going forward you just store them in macro/modules and they will be automatically registered as device elements. * You need to do a "make generated" is src/lib/netlist/build * Some_device.cpp still needs to be added to netlist.lua * Added documentation on how to add devices to netlist. * Please refer to adding_devices.md for more information.
* netlist: code maintenance and performance optimizations. Couriersud2020-09-051-11/+11
| | | | | | | | | | | * rename some misleading type names * remove callback_t and replace by better scalable approach * hide implementations details * move sources classes from putil.h to psources.h * reduce code complexity * improve parsing performance, parsing netlists now is twice as fast. * fix issues around multi-byte string support * moved psplit into pstrutil.h
* netlist: Fix processing of TRUTHTABLES for generated files. couriersud2020-08-281-1/+1
| | | | | * also made nld_devinc.h srcclean friendly. * nld_devinc.h and lib_entries.hxx are currently not used. You can try the automated build by changing NL_AUTO_DEVICES in setup.h to 1.
* netlist: Truth tables are now standalone objects. couriersud2020-08-261-13/+26
| | | | | * Added TRUTHTABLE_ENTRY to netlist language. * Please see nlm_ttl74xx for reference implementation.
* netlist: clang tidy include order fixes. couriersud2020-08-241-1/+1
|
* netlist: Remove printf debugging. couriersud2020-08-151-2/+1
| | | * also raises error if during parsing a local source is not found.
* netlist: improve parsing performance couriersud2020-08-121-2/+38
| | | * preparational work for easier device addition.
* netlist: align naming of files within the macro folder. couriersud2020-08-101-0/+24
| | | | * Use a consistent naming scheme. This is a preparational step towards improved parsing performance.
* netlist: Refactored pokenizer. couriersud2020-08-061-33/+60
| | | | | | | | | * Separated tokenizing and reading of tokens. * This enables caching of parsing results on the token level. * Implemented caching of token stream. * Overall this significantly improves parsing performance (~10x) * Next step towards a bare-bone nltool which does not depend on macro devices.
* netlist: Add a missing directive to the file parser. couriersud2020-07-281-1/+17
|
* netlist: code maintenance and bug fixes. couriersud2020-07-011-3/+3
| | | | | | | | | | | * 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
* netlist: add hints for outputs not connected. [Couriersud, Aaron Giles] couriersud2020-06-281-2/+2
| | | | | | | | | | * 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.
* netlist: Performance improvement and refactoring. [Couriersud] couriersud2020-06-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* netlist: simplify factory call structure. (nw) couriersud2020-05-201-3/+2
| | | | | This change will make it a lot easier to add enhanced functionality to the factory infrastructure. Using integral constants also improves linking stability.
* netlist: improve typesafety for source locations. (nw) couriersud2020-05-171-3/+4
| | | | | | 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.
* netlist: Extended functionality and code cleanup. [Couriersud] couriersud2020-05-121-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* netlist: Parameters evaluated when netlist is created. [Couriersud] couriersud2020-01-291-52/+8
| | | | | | | | | | | | 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.
* netlist: Code maintenance. (nw) couriersud2020-01-271-8/+37
| | | | | | | | | - 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.
* netlist: clang lint readability fixes. (nw) couriersud2020-01-251-2/+3
|
* netlist: code maintenance. (nw) couriersud2020-01-201-1/+1
| | | | | | - remove pthrow trampline as proposed by Vas. - identify throwing code by adding noexcept(false) - move "connected term" information to setup code. - srcclean
* netlist: more code maintenance. (nw) couriersud2019-11-161-61/+62
| | | | | | - refactor error messages. - Fix some drivers to cope with outputted added my the mame driver for video and sound. - Fix validation.
* netlist: maintenance. (nw) couriersud2019-11-111-93/+1
| | | | | | | - Fix automatic header generation - clang lint fixes. - srcclean - remove dead code
* netlist: first steps on the way to calculated parameters. [Couriersud] couriersud2019-11-101-28/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* netlist: code maintenance and bug fixes. (nw) couriersud2019-11-081-1/+1
| | | | | | | - 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.
* netlist: maintenance. (nw) couriersud2019-11-081-4/+0
| | | | | - switch to VS 2019 community and fix standalone build. - more migration to C++ comment style. - add some more doxygen markup.
* netlist: more consistent exception handling. (nw) couriersud2019-11-051-1/+0
| | | | Still not optimal, but better than what we had previously. No exception logging comes closer.
* netlist: code maintenance. (nw) couriersud2019-11-041-1/+1
| | | | | | | | - 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
* netlist: improve readability. (nw) couriersud2019-11-021-7/+7
| | | | | | | 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.
* netlist: add RELTOL/VNTOL solver parameters. Type safety. [Couriersud] couriersud2019-11-021-2/+10
| | | | | | | | | 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.
* netlist: maintenance and simplifcation. (nw) couriersud2019-10-311-9/+9
| | | | | | | - 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
* netlist: code maintenance. (nw) couriersud2019-10-291-1/+1
| | | | | | | | - 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
* netlist: Preprocessor enhancements. [Couriersud] couriersud2019-10-281-3/+2
| | | | | | | | | | 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.
* netlist: mame netlist reorganization. [Couriersud] couriersud2019-10-131-2/+2
| | | | | | - 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
* netlist: code maintenance (nw) couriersud2019-10-121-2/+2
| | | | - clang lint and pedantic fixes - mat_cr.h: separate solving linear systems from underlying matrix
* netlist: maintenance and lint fixes. (nw) couriersud2019-10-061-1/+0
|
* netlist: more lint corrections. (nw) couriersud2019-09-281-0/+5
| | | | - fixed lint corrections - added NOLINT where needed
* netlist: Fix MT06827. couriersud2019-04-221-1/+1
| | | | All pstonum calls now need to specify if they want local locale or the "classic" "C" locale.
* netlist: Add power terminals to most logic devices. couriersud2019-04-211-1/+13
| | | | | | | | | | | | This fixes an over simplification. Logic devices implicitly assumed that GND/VDD actually is connected to GND(i.e. 0V). There is no immediate benefit from this change. It is a preparation for the future scalability. Now all power terminals (typically 7/14, 8/16) have to be explicitly connected to the supply rails. Also added a validation mode to the netlist core. This is not intended for running, but solely to better indentify pins which are not properly connected.
* netlist: scalable error messages. couriersud2019-04-181-2/+2
| | | This approach uses functors for logging messages.
* (nw) Clean up the mess on master Vas Crabb2019-03-261-23/+20
| | | | | | | | | | | | | This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. 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.
* Revert "conflict resolution (nw)" andreasnaive2019-03-251-20/+23
| | | | | This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705.
* netlist: more cpp core guidelines work. (nw) couriersud2019-02-081-6/+5
|
* netlist: Refactoring after adding clang-tidy support to netlist makefile couriersud2019-02-071-4/+4
| | | | | | | - convert macros to c++ code. - order of device creation should not depend on std lib. - some state saving cleanup. - added support for clang-tidy to makefile. - modifications triggered by clang-tidy-9.
* netlist: pstream and ppreprocessor (now a pistream) refactoring. (nw) couriersud2019-01-191-6/+5
|
* Fix clang-8 warnings. (nw) couriersud2019-01-111-1/+1
|
* Improve type safety on string->numeric conversions. (nw) couriersud2019-01-101-4/+4
| | | | | | | Also fixed an issue with 7497. ./nltool -t 5 -f src/mame/machine/nl_tp1983.cpp -v now runs again.
* More c++ alignment. pstring now behaves like std::string. (nw) couriersud2019-01-061-6/+5
| | | | | This change removes all string extensions like trim, rpad, left, right, ... from pstring and replaces them by function templates. This aligns a lot better with the intentions of the standard library.