summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/build
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/build')
-rw-r--r--src/lib/netlist/build/.clang-format114
-rw-r--r--src/lib/netlist/build/create_devinc.py119
-rw-r--r--src/lib/netlist/build/create_lib_entries.py57
-rw-r--r--src/lib/netlist/build/create_modules.py84
-rw-r--r--src/lib/netlist/build/cspell.json166
-rw-r--r--src/lib/netlist/build/doxygen.conf11
-rw-r--r--src/lib/netlist/build/html/nltool.html366
-rw-r--r--src/lib/netlist/build/html/nlwav.html285
-rw-r--r--src/lib/netlist/build/makefile510
-rw-r--r--src/lib/netlist/build/man/nltool.1176
-rw-r--r--src/lib/netlist/build/man/nlwav.1116
-rw-r--r--src/lib/netlist/build/nltool.help2man5
-rw-r--r--src/lib/netlist/build/nlwav.help2man5
13 files changed, 1826 insertions, 188 deletions
diff --git a/src/lib/netlist/build/.clang-format b/src/lib/netlist/build/.clang-format
new file mode 100644
index 00000000000..d312a0798cc
--- /dev/null
+++ b/src/lib/netlist/build/.clang-format
@@ -0,0 +1,114 @@
+Language: Cpp
+Standard: c++17
+UseTab: ForContinuationAndIndentation
+TabWidth: 4
+IndentWidth: 4
+ColumnLimit: 80
+ContinuationIndentWidth: 4
+ConstructorInitializerIndentWidth: 0
+NamespaceIndentation: All
+CompactNamespaces: true
+FixNamespaceComments: true
+
+IndentAccessModifiers: false
+AccessModifierOffset: -4
+IndentCaseLabels: true
+
+BreakBeforeBraces: Allman
+BreakBeforeBinaryOperators: All
+BreakConstructorInitializers: BeforeComma
+# Currentline doesn't work
+# PackConstructorInitializers: CurrentLine >= 14
+BreakStringLiterals: false
+# Multiline does not work in clang-format 13
+# AlwaysBreakTemplateDeclarations: MultiLine
+AlwaysBreakTemplateDeclarations: Yes
+# AfterComma does not work <= 13
+#BreakInheritanceList: AfterComma
+BreakInheritanceList: BeforeComma
+#BreakInheritanceList: false
+SpaceBeforeInheritanceColon: true
+
+#AlignAfterOpenBracket: DontAlign
+AlignAfterOpenBracket: Align
+PointerAlignment: Right
+ReferenceAlignment: Right
+SpacesInAngles: false
+SpaceBeforeAssignmentOperators: true
+AlignConsecutiveDeclarations: true
+
+#Clang>=14
+#AlignArrayOfStructures: Left
+
+AllowShortIfStatementsOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: true
+AllowAllArgumentsOnNextLine: false
+AllowAllParametersOfDeclarationOnNextLine: false
+
+PenaltyBreakComment: 1
+PenaltyBreakAssignment: 1000
+AlwaysBreakBeforeMultilineStrings: true
+
+PenaltyReturnTypeOnItsOwnLine: 1
+
+# SortIncludes: CaseSensitive # >= 13!
+SortIncludes: true
+IncludeBlocks: Regroup
+
+IncludeCategories:
+ - Regex: '^(("|"../)core)/'
+ Priority: 20
+ - Regex: '^(("|"../)analog)/'
+ Priority: 21
+ - Regex: '^(("|"../)devices)/'
+ Priority: 22
+ - Regex: '^(("|"../)solver)/'
+ Priority: 23
+ - Regex: '^(("|"../)plib)/'
+ Priority: 30
+ - Regex: '<[([:alnum:]|_).]+>'
+ Priority: 40
+ - Regex: '.*'
+ Priority: 10
+
+StatementMacros:
+ - "DIPPINS"
+ - "TT_HEAD"
+ - "TT_LINE"
+ - "TT_FAMILY"
+# - "TRUTH_TABLE"
+# - "NETLIB_DEVICE_IMPL_NS"
+# - "TTL_7400_NAND"
+# - "TTL_7402_NOR"
+# - "NET_C"
+# - "TRUTHTABLE_ENTRY"
+ - "LOCAL_LIB_ENTRY"
+
+#StatementAttributeLikeMacros:
+# - "NETLIST_NAME"
+# - "NETLIB_NAME"
+
+TypenameMacros:
+ - "NETLIST_NAME"
+ - "NETLIB_NAME"
+ - "PENUM"
+
+WhitespaceSensitiveMacros:
+ - "ALIAS"
+ - "DIPPINS"
+ - "NET_C"
+ - "PENUM"
+
+IndentPPDirectives: BeforeHash
+MacroBlockBegin: "^static NETLIST_START\\(.+\\)|static TRUTHTABLE_START\\(.*\\)$"
+MacroBlockEnd: "^NETLIST_END\\(\\)|TRUTHTABLE_END\\(\\)$"
+
+# Avoid formatting
+# -- clang-tidy
+# - cspell
+# - Doxygen tables
+# - Doxygen commands
+# - ignored comments
+# - nltool parsed documentation
+CommentPragmas: '^( NOLINT.+| spell-checker.+|/ \|.+|/ \\.+|#.+|-.+)'
+
diff --git a/src/lib/netlist/build/create_devinc.py b/src/lib/netlist/build/create_devinc.py
new file mode 100644
index 00000000000..6888d71183f
--- /dev/null
+++ b/src/lib/netlist/build/create_devinc.py
@@ -0,0 +1,119 @@
+#!/usr/bin/python
+##
+## license:BSD-3-Clause
+## copyright-holders:Couriersud
+
+import os
+import os.path
+import re
+import sys
+import xml.sax
+import xml.sax.saxutils
+import zlib
+
+
+# workaround for version incompatibility
+if sys.version_info > (3, ):
+ long = int
+
+# globals
+
+last_src = ""
+
+def process_srcfile(srcfile):
+ global last_src
+ if (last_src != srcfile):
+ last_src = srcfile
+ print("// ---------------------------------------------------------------------")
+ print("// Source: {}".format(srcfile))
+ print("// ---------------------------------------------------------------------")
+ print("")
+
+def process_entry_external(srcfile, name):
+ process_srcfile(srcfile)
+ print("NETLIST_EXTERNAL({})".format(name))
+
+def process_entry(srcfile, name, params):
+ process_srcfile(srcfile)
+ p = re.sub("\+","",params)
+ ps = p.split(",")
+ pusage = ""
+ pauto = ""
+ for x in ps:
+ if x[0:1] == "@":
+ pauto = pauto + ", " + x[1:]
+ else:
+ pusage = pusage + ", " + x
+ print("// usage : {}(name{})".format(name, pusage))
+ if len(pauto) > 0:
+ print("// auto connect: {}".format(pauto[2:]))
+ print("#define {}(...) \\".format(name))
+ print("\tNET_REGISTER_DEVEXT({}, __VA_ARGS__)".format(name))
+ print("")
+
+
+def process_file(srcfile):
+ src = open(srcfile,'r')
+ lines = src.readlines()
+ for line in lines:
+ ls = re.sub("\s+","",line.strip())
+ ls = re.sub("^\s*//.*","",ls)
+ ls = re.sub("\"","",ls)
+ m = re.match(r"NETLIB_DEVICE_IMPL\((\w+),(\w+),([a-zA-Z0-9_+@,]*)", ls)
+ #print("Line{}: {}".format(count, line.strip()))
+ if m is not None:
+ process_entry(srcfile, m.group(2), m.group(3))
+ else:
+ m = re.match(r"NETLIB_DEVICE_IMPL_ALIAS\((\w+),(\w+),(\w+),([a-zA-Z0-9_+@,]*)", ls)
+ if m is not None:
+ process_entry(srcfile, m.group(3), m.group(4))
+ else:
+ m = re.match(r"NETLIB_DEVICE_IMPL_NS\((\w+),(\w+),(\w+),([a-zA-Z0-9_+@,]*)", ls)
+ if m is not None:
+ process_entry(srcfile, m.group(3), m.group(4))
+ else:
+ m = re.match(r"LOCAL_LIB_ENTRY\((\w+)\)", ls)
+ if m is not None:
+ process_entry(srcfile, m.group(1), "")
+ else:
+ m = re.match(r"(static)*TRUTH_TABLE\((\w+),(\w+),(\w+),([a-zA-Z0-9_+@,]*)", ls)
+ if m is not None:
+ process_entry(srcfile, m.group(2), m.group(5))
+ else:
+ #m = re.match(r"EXTERNAL_SOURCE\((\w+)\)", ls)
+ m = re.match(r"NETLIST_START\((\w+)\)", ls)
+ if m is not None:
+ process_entry_external(srcfile, m.group(1))
+
+ src.close()
+
+def file_header():
+ print("// license:BSD-3-Clause")
+ print("// copyright-holders:Couriersud")
+ print("")
+ print("#ifndef NLD_DEVINC_H")
+ print("#define NLD_DEVINC_H")
+ print("")
+ print("#ifndef __PLIB_PREPROCESSOR__\n")
+ print("")
+ print("#include \"../nl_setup.h\"")
+ print("")
+
+def file_footer():
+ print("#endif // __PLIB_PREPROCESSOR__\n")
+ print("#endif // NLD_DEVINC_H\n")
+
+if __name__ == '__main__':
+ if (len(sys.argv) == 0):
+ print('Usage:')
+ print(' create_devinc files ...')
+ sys.exit(0)
+ files_sorted = []
+ for argno in range(1, len(sys.argv)):
+ files_sorted.append(sys.argv[argno])
+ files_sorted.sort()
+ file_header()
+ for entry in files_sorted:
+ process_file(entry)
+ file_footer()
+
diff --git a/src/lib/netlist/build/create_lib_entries.py b/src/lib/netlist/build/create_lib_entries.py
new file mode 100644
index 00000000000..3d2d146fd98
--- /dev/null
+++ b/src/lib/netlist/build/create_lib_entries.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+##
+## license:BSD-3-Clause
+## copyright-holders:Couriersud
+
+import os
+import os.path
+import re
+import sys
+import xml.sax
+import xml.sax.saxutils
+import zlib
+
+
+# workaround for version incompatibility
+if sys.version_info > (3, ):
+ long = int
+
+# globals
+devices = []
+
+def process_file(srcfile):
+ src = open(srcfile,'r')
+ lines = src.readlines()
+ for line in lines:
+ ls = re.sub("\s+","",line.strip())
+ ls = re.sub("^\s*//.*","",ls)
+ m = re.match(r"NETLIB_DEVICE_IMPL\((\w+),", ls)
+ #print("Line{}: {}".format(count, line.strip()))
+ if m != None:
+ n = m.group(1)
+ devices.append(n)
+ else:
+ m = re.match(r"NETLIB_DEVICE_IMPL_ALIAS\((\w+),", ls)
+ if m != None:
+ n = m.group(1)
+ devices.append(n)
+ else:
+ m = re.match(r"NETLIB_DEVICE_IMPL_NS\((\w+),(\w+),", ls)
+ if m != None:
+ n = m.group(2)
+ devices.append(n)
+ src.close()
+
+if __name__ == '__main__':
+ if (len(sys.argv) == 0):
+ print('Usage:')
+ print(' create_lib_entries.py files...')
+ sys.exit(0)
+
+ for argno in range(1, len(sys.argv)):
+ process_file(sys.argv[argno])
+
+ devices.sort()
+ for d in devices:
+ print("LIB_ENTRY({})".format(d))
+ \ No newline at end of file
diff --git a/src/lib/netlist/build/create_modules.py b/src/lib/netlist/build/create_modules.py
new file mode 100644
index 00000000000..94cfe4a26ae
--- /dev/null
+++ b/src/lib/netlist/build/create_modules.py
@@ -0,0 +1,84 @@
+#!/usr/bin/python
+##
+## license:BSD-3-Clause
+## copyright-holders:Couriersud
+
+import os
+import os.path
+import re
+import sys
+import xml.sax
+import xml.sax.saxutils
+import zlib
+import datetime
+
+
+# workaround for version incompatibility
+if sys.version_info > (3, ):
+ long = int
+
+# globals
+
+last_src = ""
+
+def process_entry(srcfile, name, params):
+ global last_src
+ if (last_src != srcfile):
+ last_src = srcfile
+ print("// ---------------------------------------------------------------------")
+ print("// Source: {}".format(srcfile))
+ print("// ---------------------------------------------------------------------")
+ print("")
+ p = re.sub("\+","",params)
+ ps = p.split(",")
+ pusage = ""
+ pauto = ""
+ for x in ps:
+ if x[0:1] == "@":
+ pauto = pauto + ", " + x[1:]
+ else:
+ pusage = pusage + ", " + x
+ print("// usage : {}(name{})".format(name, pusage))
+ if len(pauto) > 0:
+ print("// auto connect: {}".format(pauto[2:]))
+ print("#define {}(...) \\".format(name))
+ print("\tNET_REGISTER_DEVEXT({}, __VA_ARGS__)".format(name))
+ print("")
+
+
+def process_file(srcfile):
+ src = open(srcfile,'r')
+ lines = src.readlines()
+ for line in lines:
+ ls = re.sub("\s+","",line.strip())
+ ls = re.sub("^\s*//.*","",ls)
+ ls = re.sub("\"","",ls)
+ m = re.match(r"NETLIST_START\((\w+)\)", ls)
+ if m != None:
+ print("\tEXTERNAL_LIB_ENTRY("+ m.group(1) + ")")
+ src.close()
+
+if __name__ == '__main__':
+ if (len(sys.argv) == 0):
+ print('Usage:')
+ print(' create_devinc files ...')
+ sys.exit(0)
+ files_sorted = [];
+ for argno in range(1, len(sys.argv)):
+ files_sorted.append(sys.argv[argno])
+ files_sorted.sort();
+ print("// license:CC0-1.0")
+ print("// copyright-holders:Couriersud")
+ print("")
+ now = datetime.datetime.now()
+ print("// File programmatically created " + now.strftime("%c"))
+ print("")
+ print("#include \"devices/net_lib.h\"")
+ print("")
+ print("NETLIST_START(modules_lib)")
+ print("{")
+ print("")
+ for entry in files_sorted:
+ process_file(entry)
+ print("")
+ print("}")
diff --git a/src/lib/netlist/build/cspell.json b/src/lib/netlist/build/cspell.json
new file mode 100644
index 00000000000..bf46cc2e992
--- /dev/null
+++ b/src/lib/netlist/build/cspell.json
@@ -0,0 +1,166 @@
+{
+"words" : [
+ "astable",
+ "behavioural",
+ "datasheet",
+ "datasheets",
+ "demultiplexer",
+ "demultiplexers",
+ "highpass",
+ "lowpass",
+ "misformatted", // not in leo
+ "monostable",
+ "presettable", // not in leo
+ "transconductance",
+ "retriggerable", // not in leo
+ // Names
+ "Chebyshev",
+ "Raphson",
+ "Schmitt",
+ "Schottky",
+ "Zener",
+ "Thevenin",
+ // Company names
+ "Fairchild",
+ "Signetics",
+ "Mostek",
+ // Technical terms
+ "cmos",
+ "kaby", // Kaby Lake
+ "mosfet",
+ "mosfets",
+ "nmos",
+ "opamp",
+ "opamps",
+ "picosecond",
+ "pmos",
+ // Physics
+ "atto",
+ "centi",
+ "deca",
+ "femto",
+ "giga",
+ "hecto",
+ "peta",
+ "tera",
+ "yocto",
+ "yotta",
+ "zepto",
+ "zetta",
+ // Software
+ "kicad",
+ // C library functions / definitions
+ "feenableexcept",
+ "fedisableexcept",
+ // asm
+ "rdtsc",
+ "rdtscp",
+ "cpuid",
+ // Specific project terms
+ "MAME",
+ "Couriersud",
+ "netlist",
+ "netlists",
+ "nltool",
+ "nlwav",
+ "nvcc",
+ "lfsr",
+ "gmres",
+ "nlmod_",
+ // FIXME: Remove everything below here again
+ // Excluded for now ... Still over 1000 in the log
+ "plib", // namespace
+ "isnull",
+ "pstring",
+ "passert",
+ "putf",
+ "tokstor",
+ "psplit",
+ "gmin",
+ "lastx",
+ "idrn",
+ "preprocessor",
+ "ppreprocessor",
+ "psource",
+ "psemaphore",
+ "modacc",
+ "Ainv",
+ "anetlist",
+ "netdev",
+ "solv",
+ "sexpr",
+ "pstonum",
+ "pmfp",
+ "pmatrix",
+ "pfmt",
+ "nlname",
+ "nlparse",
+ "nlstate",
+ "nlconst",
+ "nlsetup",
+ "pfmp",
+ "resched",
+ "tokenizer",
+ "ptokenizer",
+ "pexception",
+ "devs",
+ "gonn",
+ "nzbd",
+ "nthcode",
+ "Vcrit",
+ "perrmsg",
+ "pfunction",
+ "tname",
+ "stname",
+ "parray",
+ "nzrd"
+],
+"languageSettings": [
+ // This one works with Python
+ {
+ "languageId": "python",
+ "includeRegExpList": [
+ "/#.*/",
+ "/('''|\"\"\")[^\\1]+?\\1/g",
+ "strings"
+ ]
+ },
+ // This one works with JavaScript, Typescript, etc
+ {
+ "languageId": "javascript,typescript",
+ "includeRegExpList": [
+ "CStyleComment",
+ "strings"
+ ]
+ },
+ // Use with cpp or c files
+ {
+ "languageId": "cpp,c,h",
+ // Turn off compound words, because it is only checking strings.
+ "allowCompoundWords": false,
+ // Only check comments and strings
+ //"includeRegExpList": [
+ // "CStyleComment",
+ // "string"
+ //],
+ "ignoreRegExpList": [
+ "/#include.*/", // Exclude includes, because they are also strings
+ "/#pragma.*/", // Exclude pragmas, they may include strings
+ "/\/\/ NOLINT\\(.*/", // Exclude clang-tidy instructions
+ "/\/\/\/ \\\\file.*/", // Doxygen
+ "/\/\/\/ \\\\addtogroup.*/", // Doxygen
+ "/`[^`]+`/", // Markup code formatt
+ "/} \/\/ namespace.*/", // Namespace comments
+ // Project specific exclusions start here
+ "/\/\/ copyright-holders.*/",
+ "/\/\/- Pinalias:/",
+ "/\/\/#.*/", // commented source code
+ "\/\/ Source:.*/", // generated code
+ "/\\$[A-z0-9][^\\s]*/", // everything starting with a $
+ // The following should be removed again
+ "/[A-z][^\\s]+::[^\\s]+/", // any namespace qualifier
+ "/[A-Z][A-Z][A-Z][^\\s]*/" // Identifiers starting with at least 3 capital letters
+ ]
+ }
+]
+}
diff --git a/src/lib/netlist/build/doxygen.conf b/src/lib/netlist/build/doxygen.conf
index 6fb0b377e7b..dcafc37f852 100644
--- a/src/lib/netlist/build/doxygen.conf
+++ b/src/lib/netlist/build/doxygen.conf
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
-PROJECT_NAME = Netlist documentation
+PROJECT_NAME = "Netlist documentation"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@@ -475,7 +475,7 @@ HIDE_UNDOC_MEMBERS = YES
# has no effect if EXTRACT_ALL is enabled.
# The default value is: NO.
-HIDE_UNDOC_CLASSES = YES
+HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
@@ -771,7 +771,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = .. ../analog ../documentation ../devices
+INPUT = .. ../analog ../documentation ../devices ../macro ../core
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -844,7 +844,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = ../../../../nl_examples ../documentation
+EXAMPLE_PATH = ../documentation ../examples ./html
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -2019,7 +2019,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH = .. ../..
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2145,6 +2145,7 @@ DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
+
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz (see:
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
diff --git a/src/lib/netlist/build/html/nltool.html b/src/lib/netlist/build/html/nltool.html
new file mode 100644
index 00000000000..10cf6949e3f
--- /dev/null
+++ b/src/lib/netlist/build/html/nltool.html
@@ -0,0 +1,366 @@
+<!-- Creator : groff version 1.22.3 -->
+<!-- CreationDate: Sat May 14 18:10:42 2022 -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<meta name="Content-Style" content="text/css">
+<style type="text/css">
+ p { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ table { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ h1 { text-align: center }
+</style>
+<title>NLTOOL</title>
+
+</head>
+<body>
+
+<h1 align="center">NLTOOL</h1>
+
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#EXAMPLES">EXAMPLES</a><br>
+<a href="#AUTHOR">AUTHOR</a><br>
+<a href="#COPYRIGHT">COPYRIGHT</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+
+
+<h2>NAME
+<a name="NAME"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">nltool &minus;
+manual page for nltool (netlist) 0.14</p>
+
+<h2>SYNOPSIS
+<a name="SYNOPSIS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>nltool</b>
+[<i>option</i>]... [<i>files</i>]...</p>
+
+<h2>DESCRIPTION
+<a name="DESCRIPTION"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">nltool serves
+as the Swiss Army knife to run, test and convert
+netlists.</p>
+
+<p style="margin-left:11%; margin-top: 1em">Commands may
+accept one or more files depending on the functionality. If
+no file is provided, standard input is used.</p>
+
+<h2>OPTIONS
+<a name="OPTIONS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>General
+options:</b></p>
+
+<p style="margin-left:22%;">The following options apply to
+all commands.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="89%">
+
+
+<p style="margin-top: 1em"><b>&minus;c</b>,
+<b>&minus;&minus;cmd</b>=<i>run</i>|validate|convert|listdevices|listmodels|static|header|docheader|tests</p> </td></tr>
+</table>
+
+
+<p style="margin-left:22%; margin-top: 1em">run|validate|convert|listdevices|listmodels|static|header|docheader|tests</p>
+
+<p><b>&minus;I</b>,
+<b>&minus;&minus;include</b>=<i>Value</i></p> </table>
+
+<p style="margin-left:22%;">Add the directory to the list
+of directories to be searched for header files. This option
+may be specified repeatedly.</p>
+
+<p style="margin-left:11%;"><b>&minus;D</b>,
+<b>&minus;&minus;define</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">predefine value as macro, e.g.
+<b>&minus;Dname</b>=<i>value</i>. If &rsquo;=value&rsquo; is
+omitted predefine it as 1. This option may be specified
+repeatedly.</p>
+
+<p style="margin-left:11%;"><b>&minus;r</b>,
+<b>&minus;&minus;rom</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">where to look for data
+files</p>
+
+<p style="margin-left:11%;"><b>&minus;v</b>,
+<b>&minus;&minus;verbose</b></p>
+
+<p style="margin-left:22%;">be verbose &minus; this
+produces lots of output</p>
+
+<p style="margin-left:11%;"><b>&minus;q</b>,
+<b>&minus;&minus;quiet</b></p>
+
+<p style="margin-left:22%;">be quiet &minus; no
+warnings</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;prepro</b></p>
+
+<p style="margin-left:22%;">output preprocessor output to
+stderr</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;progress</b></p>
+
+<p style="margin-left:22%;">show progress bar on longer
+operations</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;version</b></p>
+
+<p style="margin-left:22%;">display version and exit</p>
+
+<p style="margin-left:11%;"><b>&minus;h</b>,
+<b>&minus;&minus;help</b></p>
+
+<p style="margin-left:22%;">display help and exit</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Options for
+run and static commands:</b></p>
+
+<p style="margin-left:22%;">These options apply to run and
+static commands.</p>
+
+<p style="margin-left:11%;"><b>&minus;n</b>,
+<b>&minus;&minus;name</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">the netlist in file specified
+by <b>&minus;f</b> option to run; default is first one</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Options for
+static command:</b></p>
+
+<p style="margin-left:22%;">These options apply to static
+command.</p>
+
+<p style="margin-left:11%;"><b>&minus;d</b>,
+<b>&minus;&minus;dir</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">output directory for the
+generated files.</p>
+
+<p style="margin-left:11%;"><b>&minus;o</b>,
+<b>&minus;&minus;output</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">single output file for the
+generated code. Either <b>&minus;&minus;dir</b> or
+<b>&minus;&minus;output</b> can be specificied</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;static_include</b></p>
+
+<p style="margin-left:22%;">write static solvers to
+individual files included by file specified with
+<b>&minus;&minus;output</b>. <b>&minus;&minus;dir</b> must
+be path to &quot;generated/static&quot; path in netlist
+folder.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Options for
+run command:</b></p>
+
+<p style="margin-left:22%;">These options are only used by
+the run command.</p>
+
+<p style="margin-left:11%;"><b>&minus;t</b>,
+<b>&minus;&minus;time_to_run</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">time to run the emulation
+(seconds)</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;boost_lib</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">generic: will use generic
+solvers. builtin: Use optimized solvers compiled in.
+somelib.so: Use library with precompiled solvers.</p>
+
+<p style="margin-left:11%;"><b>&minus;s</b>,
+<b>&minus;&minus;statistics</b></p>
+
+<p style="margin-left:22%;">gather runtime statistics</p>
+
+<p style="margin-left:11%;"><b>&minus;l</b>,
+<b>&minus;&minus;log</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">define terminal to log. This
+option may be specified repeatedly.</p>
+
+<p style="margin-left:11%;"><b>&minus;i</b>,
+<b>&minus;&minus;input</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">input file to process (default
+is none)</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;loadstate</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">load state from file and
+continue from there</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;savestate</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">save state to file at end of
+run</p>
+
+<p style="margin-left:11%;"><b>&minus;&minus;fperr</b></p>
+
+<p style="margin-left:22%;">raise exception on floating
+point errors. This is intended to be used during
+debugging.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Options for
+convert command:</b></p>
+
+<p style="margin-left:22%;">These options are only used by
+the convert command.</p>
+
+<p style="margin-left:11%;"><b>&minus;y</b>,
+<b>&minus;&minus;type</b>=<i>spice</i>|eagle|rinf</p>
+
+<p style="margin-left:22%;">type of file to be converted:
+spice,eagle,rinf</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Options for
+validate command:</b></p>
+
+<p style="margin-left:22%;">These options are only used by
+the validate command.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Options for
+header command:</b></p>
+
+<p style="margin-left:22%;">These options are only used by
+the header command.</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;tab&minus;width</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">Tab width for output.</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;line&minus;width</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">Line width for output.</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;pattern</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">Pattern to match against device
+names. If the device name contains pattern, the device will
+be included in the output. Multiple patterns can be
+specified, if none is given, all devices will be output.</p>
+
+<h2>EXAMPLES
+<a name="EXAMPLES"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">nltool &minus;c
+run &minus;t 3.5 &minus;n cap_delay nl_examples/cdelay.c</p>
+
+<p style="margin-left:22%; margin-top: 1em">Run netlist
+&quot;cap_delay&quot; from file nl_examples/cdelay.c for 3.5
+seconds</p>
+
+<p style="margin-left:11%; margin-top: 1em">nltool
+&minus;&minus;cmd=listdevices</p>
+
+<p style="margin-left:22%; margin-top: 1em">List all known
+devices.</p>
+
+<p style="margin-left:11%; margin-top: 1em">nltool
+&minus;&minus;cmd=header &minus;&minus;tab&minus;width=8
+&minus;&minus;line&minus;width=80</p>
+
+<p style="margin-left:22%; margin-top: 1em">Create the
+header file needed for including netlists as code.</p>
+
+<p style="margin-left:11%; margin-top: 1em">nltool
+&minus;&minus;cmd static &minus;&minus;output</p>
+
+
+<p style="margin-left:22%; margin-top: 1em">src/lib/netlist/generated/static_solvers.cpp
+src/mame/audio/nl_*.cpp src/mame/machine/nl_*.cpp</p>
+
+<p style="margin-left:22%; margin-top: 1em">Create static
+solvers for the MAME project using one single source
+file.</p>
+
+<p style="margin-left:11%; margin-top: 1em">nltool
+&minus;&minus;cmd static &minus;&minus;output</p>
+
+
+<p style="margin-left:22%; margin-top: 1em">src/lib/netlist/generated/static_solvers.cpp
+&minus;&minus;dir src/lib/netlist/generated/static
+&minus;&minus;static_include src/mame/audio/nl_*.cpp
+src/mame/machine/nl_*.cpp</p>
+
+<p style="margin-left:22%; margin-top: 1em">Create static
+solvers for the MAME project using a single source file
+which includes generated solvers written to
+&minus;&minus;dir folder.</p>
+
+<p style="margin-left:11%; margin-top: 1em">nltool
+&minus;&minus;cmd tests</p>
+
+<p style="margin-left:22%; margin-top: 1em">Run unit tests.
+In case the unit tests are not linked in, this will do
+nothing.</p>
+
+<h2>AUTHOR
+<a name="AUTHOR"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Written by
+Couriersud.</p>
+
+<h2>COPYRIGHT
+<a name="COPYRIGHT"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Copyright
+&copy; 2021 Couriersud License BSD&minus;3&minus;Clause <br>
+This is free software: you are free to change and
+redistribute it. There is NO WARRANTY, to the extent
+permitted by law.</p>
+
+<h2>SEE ALSO
+<a name="SEE ALSO"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">More
+documentation for the <b>nltool</b> program is available in
+doxygen format.</p>
+<hr>
+</body>
+</html>
diff --git a/src/lib/netlist/build/html/nlwav.html b/src/lib/netlist/build/html/nlwav.html
new file mode 100644
index 00000000000..d1e14b1528d
--- /dev/null
+++ b/src/lib/netlist/build/html/nlwav.html
@@ -0,0 +1,285 @@
+<!-- Creator : groff version 1.22.3 -->
+<!-- CreationDate: Sat May 14 18:10:42 2022 -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<meta name="Content-Style" content="text/css">
+<style type="text/css">
+ p { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ table { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ h1 { text-align: center }
+</style>
+<title>NLWAV</title>
+
+</head>
+<body>
+
+<h1 align="center">NLWAV</h1>
+
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#EXAMPLES">EXAMPLES</a><br>
+<a href="#AUTHOR">AUTHOR</a><br>
+<a href="#COPYRIGHT">COPYRIGHT</a><br>
+<a href="#SEE ALSO">SEE ALSO</a><br>
+
+<hr>
+
+
+<h2>NAME
+<a name="NAME"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">nlwav &minus;
+manual page for nlwav (netlist) 0.1</p>
+
+<h2>SYNOPSIS
+<a name="SYNOPSIS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>nlwav</b>
+[<i>OPTION</i>] ... [<i>FILE</i>] ...</p>
+
+<h2>DESCRIPTION
+<a name="DESCRIPTION"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Convert netlist
+log files into wav files.</p>
+
+<h2>OPTIONS
+<a name="OPTIONS"></a>
+</h2>
+
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>&minus;f</b>,
+<b>&minus;&minus;format</b>=<i>wav16s</i>|wav32s|wav32f|vcda|vcdd|tab</p>
+
+<p style="margin-left:22%;">output format. Available
+options are wav16s|wav32s|wav32f|vcda|vcdd|tab.</p>
+
+<table width="100%" border="0" rules="none" frame="void"
+ cellspacing="0" cellpadding="0">
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="9%">
+
+
+<p>wav16s</p></td>
+<td width="2%"></td>
+<td width="60%">
+
+
+<p>: multichannel wav output 16 bit signed</p></td>
+<td width="18%">
+</td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="9%">
+
+
+<p>wav32s</p></td>
+<td width="2%"></td>
+<td width="60%">
+
+
+<p>: multichannel wav output 32 bit signed</p></td>
+<td width="18%">
+</td></tr>
+<tr valign="top" align="left">
+<td width="11%"></td>
+<td width="9%">
+
+
+<p>wav32f</p></td>
+<td width="2%"></td>
+<td width="60%">
+
+
+<p>: multichannel wav output 32 bit float</p></td>
+<td width="18%">
+</td></tr>
+</table>
+
+<p style="margin-left:11%;">vcda : analog VCD output</p>
+
+<p style="margin-left:22%;">vcdd : digital VCD output tab :
+sampled output Digital signals are created using the
+<b>&minus;&minus;high</b> and</p>
+
+
+<p style="margin-left:22%; margin-top: 1em"><b>&minus;&minus;low</b>
+options</p>
+
+<p style="margin-left:11%;"><b>&minus;o</b>,
+<b>&minus;&minus;output</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">output file</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>wav
+options:</b></p>
+
+<p style="margin-left:22%;">These options apply to wav
+output only</p>
+
+<p style="margin-left:11%;"><b>&minus;r</b>,
+<b>&minus;&minus;rate</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">sample rate of output file</p>
+
+<p style="margin-left:11%;"><b>&minus;a</b>,
+<b>&minus;&minus;amp</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">amplification after mean
+correction</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;lowpass</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">lowpass filter frequency.
+Default 20000 Hz.</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;highpass</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">highpass filter frequency.
+Default is 20 Hz.</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;hpboost</b></p>
+
+<p style="margin-left:22%;">enable highpass boost to filter
+out initial click.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>vcdd
+options:</b></p>
+
+<p style="margin-left:22%;">These options apply to vcdd
+output only</p>
+
+<p style="margin-left:11%;"><b>&minus;u</b>,
+<b>&minus;&minus;high</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">minimum input for high
+level</p>
+
+<p style="margin-left:11%;"><b>&minus;l</b>,
+<b>&minus;&minus;low</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">maximum input for low level</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>tab
+options:</b></p>
+
+<p style="margin-left:22%;">These options apply to sampled
+output only</p>
+
+<p style="margin-left:11%;"><b>&minus;s</b>,
+<b>&minus;&minus;start</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">time when sampling starts</p>
+
+<p style="margin-left:11%;"><b>&minus;i</b>,
+<b>&minus;&minus;increment</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">time between samples</p>
+
+<p style="margin-left:11%;"><b>&minus;n</b>,
+<b>&minus;&minus;samples</b>=<i>Value</i></p>
+
+<p style="margin-left:22%;">number of samples</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>General
+options:</b></p>
+
+<p style="margin-left:22%;">These options always apply</p>
+
+<p style="margin-left:11%;"><b>&minus;v</b>,
+<b>&minus;&minus;verbose</b></p>
+
+<p style="margin-left:22%;">be verbose &minus; this
+produces lots of output</p>
+
+<p style="margin-left:11%;"><b>&minus;q</b>,
+<b>&minus;&minus;quiet</b></p>
+
+<p style="margin-left:22%;">be quiet &minus; no
+warnings</p>
+
+
+<p style="margin-left:11%;"><b>&minus;&minus;version</b></p>
+
+<p style="margin-left:22%;">display version and exit</p>
+
+<p style="margin-left:11%;"><b>&minus;h</b>,
+<b>&minus;&minus;help</b></p>
+
+<p style="margin-left:22%;">display help and exit</p>
+
+<h2>EXAMPLES
+<a name="EXAMPLES"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">./nlwav
+&minus;f vcdd &minus;o x.vcd log_V*</p>
+
+<p style="margin-left:22%; margin-top: 1em">convert all
+files starting with &quot;log_V&quot; into a digital vcd
+file</p>
+
+<p style="margin-left:11%; margin-top: 1em">./nlwav
+&minus;f wav16s &minus;o x.wav log_V*</p>
+
+<p style="margin-left:22%; margin-top: 1em">convert all
+files starting with &quot;log_V&quot; into a multichannel
+wav file (16bit, signed)</p>
+
+<p style="margin-left:11%; margin-top: 1em">./nlwav
+&minus;f tab &minus;o x.tab &minus;s 0.0000005 &minus;i
+0.000001 &minus;n 256 log_BLUE.log</p>
+
+<p style="margin-left:22%; margin-top: 1em">convert file
+log_BLUE.log to sampled output. First sample at 500ns
+followed by 255 samples every micro&minus;second.</p>
+
+<h2>AUTHOR
+<a name="AUTHOR"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Written by
+Couriersud.</p>
+
+<h2>COPYRIGHT
+<a name="COPYRIGHT"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Copyright
+&copy; 2021 Couriersud License BSD&minus;3&minus;Clause <br>
+This is free software: you are free to change and
+redistribute it. There is NO WARRANTY, to the extent
+permitted by law.</p>
+
+<h2>SEE ALSO
+<a name="SEE ALSO"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">More
+documentation for the <b>nlwav</b> program is available in
+doxygen format.</p>
+<hr>
+</body>
+</html>
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile
index 4df755e5396..2a63e816c0a 100644
--- a/src/lib/netlist/build/makefile
+++ b/src/lib/netlist/build/makefile
@@ -2,171 +2,219 @@
#
# makefile
#
-# Core makefile for building MAME and derivatives
-#
-# Copyright (c) Nicola Salmoria and the MAME Team.
-# Visit http://mamedev.org for licensing and usage restrictions.
+# Core makefile for building netlist
#
###########################################################################
+#
+# Notes:
+# These should go into some compile.md
+#
+# Mingw notes:
+#
+# graphviz is needed for documentation
+# pacman -S mingw-w64-x86_64-graphviz
+#
+# Please build documentation using
+# make mingw PARAMS=doc
+#
+#
+
+.DEFAULT_GOAL := all
+
SRC = ..
+#SRC = $(abspath ..)
+
+PSRC = $(SRC)/plib
VSBUILD = $(SRC)/buildVS
DOC = $(SRC)/documentation
-TIDY_DB = ../compile_commands.json
-TIDY_FLAGSX = -checks=*,-google*,-hicpp*,-readability*,-fuchsia*,cert-*,-android-*,
-TIDY_FLAGSX += -llvm-header-guard,-cppcoreguidelines-pro-type-reinterpret-cast,
-TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-owning-memory,
+TIDY_FLAGSX = -checks=*,-google*,-hicpp*,readability*,-fuchsia*,cert-*,-android-*,-altera*,
+TIDY_FLAGSX += -llvm-header-guard,
+# TIDY_FLAGSX += -cppcoreguidelines-pro-type-reinterpret-cast,
+TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-pointer-arithmetic,
+#TIDY_FLAGSX += -cppcoreguidelines-owning-memory,
TIDY_FLAGSX += -modernize-use-default-member-init,-cppcoreguidelines-pro-bounds-constant-array-index,
-TIDY_FLAGSX += -modernize-pass-by-value,-cppcoreguidelines-pro-type-static-cast-downcast,
+TIDY_FLAGSX += -modernize-pass-by-value,
+#TIDY_FLAGSX += -cppcoreguidelines-pro-type-static-cast-downcast,
TIDY_FLAGSX += -cppcoreguidelines-avoid-magic-numbers,
TIDY_FLAGSX += -cppcoreguidelines-macro-usage,
TIDY_FLAGSX += -cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,
-TIDY_FLAGSX += -bugprone-macro-parentheses,-misc-macro-parentheses,
-TIDY_FLAGSX += -modernize-use-trailing-return-type
-
-space :=
-space +=
-TIDY_FLAGS = $(subst $(space),,$(TIDY_FLAGSX))
-
-#TIDY_FLAGS = -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix
+TIDY_FLAGSX += -bugprone-macro-parentheses,
+#TIDY_FLAGSX += -misc-macro-parentheses,
+TIDY_FLAGSX += -bugprone-too-small-loop-variable,
+TIDY_FLAGSX += -modernize-use-trailing-return-type,
+TIDY_FLAGSX += -readability-magic-numbers,-readability-braces-around-statements,
+TIDY_FLAGSX += -readability-implicit-bool-conversion,
+TIDY_FLAGSX += -readability-named-parameter,-readability-function-size,
+TIDY_FLAGSX += -llvmlibc-restrict-system-libc-headers,-llvmlibc-implementation-in-namespace,-llvmlibc-callee-namespace,
+TIDY_FLAGSX += -modernize-use-nodiscard,
+TIDY_FLAGSX += -modernize-use-auto,
+#TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+#TIDY_FLAGSX += -cppcoreguidelines-prefer-member-initializer,
+#TIDY_FLAGSX += -modernize-use-transparent-functors,
+TIDY_FLAGSX += -readability-function-cognitive-complexity,
+TIDY_FLAGSX += -readability-uppercase-literal-suffix
+TIDY_FLAGSX += -cert-err58-cpp
+
+
+#TIDY_FLAGSX += -cppcoreguidelines-avoid-non-const-global-variables
+
+space :=
+space +=
+TIDY_FLAGS = -p $(OBJ) $(subst $(space),,$(TIDY_FLAGSX))
+TIDY_SOURCES = $(ALLSOURCES)
+
+#TIDY_SOURCES = $(SRC)/devices/nld_7442.cpp $(SRC)/devices/nld_7492.cpp
+
+#TIDY_FLAGS = -p $(OBJ) -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix
#TIDY_FLAGS = -checks=llvm-include-order -fix
#TIDY_FLAGS = -checks=llvm-namespace-comment -fix
#TIDY_FLAGS = -checks=modernize-use-override -fix
#TIDY_FLAGS = -checks=modernize-use-using -fix
-ifeq ($(subst Windows_NT,windows,$(OS)),windows)
+ifeq ($(subst Windows_NT,Windows,$(OS)),Windows)
+ HOSTARCH := Windows
+else
+ HOSTARCH := $(shell uname -s)
+endif
+
+ifeq ($(HOSTARCH),Windows)
OBJ = obj/mingw
+EXESUFFIX = .exe
+DOXYGEN = doxygen.exe
+CEXTRAFLAGS = -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN
+LDEXTRAFLAGS = -Wl,--subsystem,console -municode
+LIBS = $(EXTRALIBS)
+MD = @mkdir.exe
+RM = @rm.exe
+SHELL = sh.exe
+else ifeq ($(HOSTARCH),Darwin)
+OBJ = obj/darwin
+EXESUFFIX :=
+DOXYGEN = @doxygen
+LIBS = -lpthread -ldl $(EXTRALIBS)
+MD = @mkdir
+RM = @rm
else
OBJ = obj/nix
+EXESUFFIX :=
+DOXYGEN = @./doxygen
+LIBS = -lpthread -ldl $(EXTRALIBS)
+MD = @mkdir
+RM = @rm
endif
-#-fuse-ld=gold -Wpedantic -march=native -march=native
+CSPELL=cspell
+PYTHON=@python
-# LTO = -flto=4 -fuse-linker-plugin -flto-partition=balanced -Wodr
+TIDY_DB = $(OBJ)/compile_commands.json
-CFLAGS = $(LTO) -g -O3 -std=c++11 -I$(CURDIR)/.. -I$(CURDIR)/../.. $(CEXTRAFLAGS)
-LDFLAGS = $(LTO) -g -O3 -std=c++11 $(LDEXTRAFLAGS)
-LIBS = -lpthread -ldl
+
+#LTO decreases performance :-(
+#LTO = -flto=4 -fuse-linker-plugin -Wodr
+
+CCOREFLAGS = -g -O3 -std=c++17 -I$(SRC)
+
+CFLAGS = $(LTO) $(CCOREFLAGS) $(CEXTRAFLAGS)
+LDFLAGS = $(LTO) -g -O3 -std=c++17 $(LDEXTRAFLAGS)
CC = g++
-LD = @g++
-MD = @mkdir
-RM = @rm
-DOXYGEN = @doxygen
-CLANG_TIDY = clang-tidy-9
+LD = g++
+CLANG_TIDY = clang-tidy-13
+DEPENDCC=$(CC)
+
+
+ifndef FAST
+FAST=1
+endif
+
+ifeq ($(FAST),1)
+CFLAGS += -DNL_USE_ACADEMIC_SOLVERS=0
+endif
-TARGETS = nltool nlwav
+TARGETS = nltool$(EXESUFFIX) nlwav$(EXESUFFIX)
NLOBJ = $(OBJ)
POBJ = $(OBJ)/plib
+TESTOBJ = $(OBJ)/tests
+
+DEPEND := $(OBJ)/.depend
OBJDIRS = $(OBJ) \
$(OBJ)/analog \
$(OBJ)/solver \
$(OBJ)/devices \
$(OBJ)/plib \
- $(OBJ)/devices \
$(OBJ)/macro \
+ $(OBJ)/macro/modules \
+ $(OBJ)/tests \
$(OBJ)/tools \
$(OBJ)/prg \
-
-
-OBJS = $(POBJS) $(NLOBJS)
-
-POBJS := \
- $(POBJ)/pstring.o \
- $(POBJ)/pchrono.o \
- $(POBJ)/pdynlib.o \
- $(POBJ)/pexception.o \
- $(POBJ)/pfunction.o \
- $(POBJ)/pfmtlog.o \
- $(POBJ)/poptions.o \
- $(POBJ)/pparser.o \
- $(POBJ)/pstate.o \
- $(POBJ)/pstream.o \
- $(POBJ)/putil.o \
-
-PMAIN := $(POBJ)/pmain.o
-
-NLOBJS := \
- $(NLOBJ)/nl_base.o \
- $(NLOBJ)/nl_parser.o \
- $(NLOBJ)/nl_setup.o \
- $(NLOBJ)/nl_factory.o \
- $(NLOBJ)/analog/nld_bjt.o \
- $(NLOBJ)/analog/nld_mosfet.o \
- $(NLOBJ)/analog/nlid_fourterm.o \
- $(NLOBJ)/analog/nld_switches.o \
- $(NLOBJ)/analog/nlid_twoterm.o \
- $(NLOBJ)/analog/nld_opamps.o \
- $(NLOBJ)/devices/nld_2102A.o \
- $(NLOBJ)/devices/nld_2716.o \
- $(NLOBJ)/devices/nld_tms4800.o \
- $(NLOBJ)/devices/nld_4020.o \
- $(NLOBJ)/devices/nld_4066.o \
- $(NLOBJ)/devices/nld_4316.o \
- $(NLOBJ)/devices/nld_7448.o \
- $(NLOBJ)/devices/nld_7450.o \
- $(NLOBJ)/devices/nld_7473.o \
- $(NLOBJ)/devices/nld_7474.o \
- $(NLOBJ)/devices/nld_7475.o \
- $(NLOBJ)/devices/nld_7483.o \
- $(NLOBJ)/devices/nld_7485.o \
- $(NLOBJ)/devices/nld_7490.o \
- $(NLOBJ)/devices/nld_7493.o \
- $(NLOBJ)/devices/nld_7497.o \
- $(NLOBJ)/devices/nld_74107.o \
- $(NLOBJ)/devices/nld_74123.o \
- $(NLOBJ)/devices/nld_74153.o \
- $(NLOBJ)/devices/nld_74161.o \
- $(NLOBJ)/devices/nld_74164.o \
- $(NLOBJ)/devices/nld_74165.o \
- $(NLOBJ)/devices/nld_74166.o \
- $(NLOBJ)/devices/nld_74174.o \
- $(NLOBJ)/devices/nld_74175.o \
- $(NLOBJ)/devices/nld_74192.o \
- $(NLOBJ)/devices/nld_74193.o \
- $(NLOBJ)/devices/nld_74194.o \
- $(NLOBJ)/devices/nld_74365.o \
- $(NLOBJ)/devices/nld_74ls629.o \
- $(NLOBJ)/devices/nld_82S16.o \
- $(NLOBJ)/devices/nld_82S115.o \
- $(NLOBJ)/devices/nld_82S123.o \
- $(NLOBJ)/devices/nld_82S126.o \
- $(NLOBJ)/devices/nld_9310.o \
- $(NLOBJ)/devices/nld_9316.o \
- $(NLOBJ)/devices/nld_9322.o \
- $(NLOBJ)/devices/nld_am2847.o \
- $(NLOBJ)/devices/nld_dm9314.o \
- $(NLOBJ)/devices/nld_dm9334.o \
- $(NLOBJ)/devices/nld_mm5837.o \
- $(NLOBJ)/devices/nld_ne555.o \
- $(NLOBJ)/devices/nld_r2r_dac.o \
- $(NLOBJ)/devices/nld_tristate.o \
- $(NLOBJ)/devices/nld_schmitt.o \
- $(NLOBJ)/devices/nld_legacy.o \
- $(NLOBJ)/devices/net_lib.o \
- $(NLOBJ)/devices/nld_log.o \
- $(NLOBJ)/devices/nlid_proxy.o \
- $(NLOBJ)/devices/nld_system.o \
- $(NLOBJ)/devices/nlid_truthtable.o \
- $(NLOBJ)/macro/nlm_base.o \
- $(NLOBJ)/macro/nlm_cd4xxx.o \
- $(NLOBJ)/macro/nlm_opamp.o \
- $(NLOBJ)/macro/nlm_other.o \
- $(NLOBJ)/macro/nlm_ttl74xx.o \
- $(NLOBJ)/solver/nld_solver.o \
- $(NLOBJ)/solver/nld_matrix_solver.o \
- $(NLOBJ)/tools/nl_convert.o \
-
-VSBUILDS = \
- $(VSBUILD/netlistlib.vcxproj) \
- $(VSBUILD/netlistlib.vcxproj.user \
- $(VSBUILD/nltool.vcxproj \
- $(VSBUILD/netlistlib.vcxproj.filters \
- $(VSBUILD/nltool.vcxproj.filters \
- $(VSBUILD/netlist.sln \
+ $(OBJ)/generated
+
+MODULESOURCES += $(wildcard $(SRC)/macro/modules/*.cpp)
+DEVSOURCES = $(SRC)/solver/nld_solver.cpp
+DEVSOURCES += $(wildcard $(SRC)/devices/*.cpp)
+DEVSOURCES += $(wildcard $(SRC)/analog/*.cpp)
+DEVSOURCES += $(wildcard $(SRC)/macro/*.cpp)
+DEVSOURCES += $(MODULESOURCES)
+DEVSOURCES += $(SRC)/generated/nlm_modules_lib.cpp
+
+TESTSOURCES = $(wildcard $(SRC)/tests/*.cpp)
+
+CORESOURCES := \
+ $(SRC)/solver/nld_matrix_solver.cpp \
+ $(SRC)/nl_base.cpp \
+ $(SRC)/nl_parser.cpp \
+ $(SRC)/nl_setup.cpp \
+ $(SRC)/nl_factory.cpp \
+ $(SRC)/tools/nl_convert.cpp \
+ $(SRC)/generated/static_solvers.cpp
+
+MAINSOURCES = $(SRC)/prg/nltool.cpp $(SRC)/prg/nlwav.cpp
+
+HEADERS = $(wildcard $(SRC)/analog/*.h)
+HEADERS += $(wildcard $(SRC)/core/*.h)
+HEADERS += $(wildcard $(SRC)/devices/*.h)
+HEADERS += $(wildcard $(SRC)/solver/*.h)
+HEADERS += $(wildcard $(SRC)/tools/*.h)
+HEADERS += $(wildcard $(SRC)/*.h)
+HEADERS += $(wildcard $(SRC)/generated/*.h)
+
+PHEADERS = $(wildcard $(SRC)/plib/*.h)
+
+PSOURCES := \
+ $(PSRC)/pstring.cpp \
+ $(PSRC)/pdynlib.cpp \
+ $(PSRC)/pexception.cpp \
+ $(PSRC)/pfunction.cpp \
+ $(PSRC)/pfmtlog.cpp \
+ $(PSRC)/pmain.cpp \
+ $(PSRC)/poptions.cpp \
+ $(PSRC)/ppmf.cpp \
+ $(PSRC)/ppreprocessor.cpp \
+ $(PSRC)/ptokenizer.cpp \
+ $(PSRC)/putil.cpp
+
+NLOBJS = $(patsubst $(SRC)%, $(OBJ)%, $(CORESOURCES:.cpp=.o))
+NLDEVOBJS = $(patsubst $(SRC)%, $(OBJ)%, $(DEVSOURCES:.cpp=.o))
+TESTOBJS = $(patsubst $(SRC)%, $(OBJ)%, $(TESTSOURCES:.cpp=.o))
+MAINOBJS = $(patsubst $(SRC)%, $(OBJ)%, $(MAINSOURCES:.cpp=.o))
+POBJS = $(patsubst $(SRC)%, $(OBJ)%, $(PSOURCES:.cpp=.o))
+
+OBJS = $(TESTOBJS) $(POBJS) $(NLOBJS) $(NLDEVOBJS) $(TESTOBJS)
+
+VSFILES = \
+ $(VSBUILD)/netlistlib.vcxproj \
+ $(VSBUILD)/netlistlib.vcxproj.filters \
+ $(VSBUILD)/nltool.vcxproj \
+ $(VSBUILD)/nltool.vcxproj.filters \
+ $(VSBUILD)/nlwav.vcxproj \
+ $(VSBUILD)/nlwav.vcxproj.filters \
+ $(VSBUILD)/netlist.sln
+
+OTHERFILES = makefile
DOCS = \
doxygen.conf \
@@ -174,134 +222,222 @@ DOCS = \
$(DOC)/mainpage.dox.h \
$(DOC)/primer_1.dox.h \
$(DOC)/structure.dox.h \
- $(DOC)/test1-50r.svg \
+ $(DOC)/test1-50r.svg
-ALL_OBJS = $(OBJS) $(PMAIN) $(NLOBJ)/prg/nltool.o $(NLOBJ)/prg/nlwav.o
+ALL_OBJS = $(OBJS) $(MAINOBJS)
ALL_TIDY_FILES = $(ALL_OBJS:.o=.json)
-SOURCES = $(patsubst $(OBJ)%, $(SRC)%, $(ALL_OBJS:.o=.cpp))
-ALLFILES = $(SOURCES) $(VSBUILDS) $(DOCS)
+ALLSOURCES = $(DEVSOURCES) $(CORESOURCES) $(TESTSOURCES) $(MAINSOURCES) $(PSOURCES)
+ALLHEADERS = $(HEADERS) $(PHEADERS)
+ALLFILES = $(ALLSOURCES) $(VSFILES) $(DOCS) $(OTHERFILES)
-MAKEFILE_TARGETS_WITHOUT_INCLUDE := clean doc clang mingw nvcc
+MAKEFILE_TARGETS_WITHOUT_INCLUDE := \
+ clang clang-5 clang-libc gcc9 mingw native nvcc \
+ clean depend doc generated manpages maketree \
+ runtests tidy fix_permissions precommit srcclean
+BUILD_DIRS = $(OBJDIRS) man html
# git archive HEAD --prefix=project-name-version/ \
# --format=zip -o project-name-version.zip
#-------------------------------------------------
+# PHONY
+#-------------------------------------------------
+
+.PHONY: $(MAKEFILE_TARGETS_WITHOUT_INCLUDE)
+
+#-------------------------------------------------
# all
#-------------------------------------------------
-all: maketree depend $(TARGETS)
+all: maketree $(DEPEND) $(TARGETS)
#-------------------------------------------------
# clean
#-------------------------------------------------
clean:
- $(RM) -rf $(OBJS) $(TARGETS) $(OBJ)/prg/nltool.o $(OBJ)/prg/nlwav.o .depend doxy/*
+ $(RM) -rf $(OBJS) $(TARGETS) $(MAINOBJS) $(DEPEND) doxy/*
#-------------------------------------------------
# nltool
#-------------------------------------------------
-nltool: $(OBJ)/prg/nltool.o $(PMAIN) $(OBJS)
+nltool$(EXESUFFIX): $(OBJ)/prg/nltool.o $(OBJS)
@echo Linking $@...
- $(LD) -o $@ $(LDFLAGS) $^ $(LIBS)
+ @$(LD) -o $@ $(LDFLAGS) $^ $(LIBS)
-nlwav: $(OBJ)/prg/nlwav.o $(PMAIN) $(OBJS)
+nlwav$(EXESUFFIX): $(OBJ)/prg/nlwav.o $(OBJS)
@echo Linking $@...
- $(LD) -o $@ $(LDFLAGS) $^ $(LIBS)
+ @$(LD) -o $@ $(LDFLAGS) $^ $(LIBS)
#-------------------------------------------------
# directories
#-------------------------------------------------
-$(sort $(OBJDIRS)):
+$(sort $(BUILD_DIRS)):
$(MD) -p $@
-maketree: $(sort $(OBJDIRS))
+maketree: $(sort $(BUILD_DIRS))
#-------------------------------------------------
# Special targets
#-------------------------------------------------
-.PHONY: clang clang-5 mingw doc native
-
-native:
- $(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra "
+native:
+ $(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra"
-gcc9:
- $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra "
+gcc9:
+ $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -Wall -Wextra -pedantic -Wpedantic -pedantic-errors -fext-numeric-literals -Wsign-compare" EXTRALIBS="-lquadmath" OBJ=obj/gcc9
clang:
- $(MAKE) CC=clang++-10 LD=clang++-10 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-padded -Wno-weak-vtables -Wno-unused-template -Wno-missing-variable-declarations -Wno-float-equal -Wconversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-exit-time-destructors"
-
-clang-5:
- $(MAKE) CC=clang++-5.0 LD=clang++-5.0 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-inconsistent-missing-destructor-override -Wno-unreachable-code -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors"
+ #$(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang CEXTRAFLAGS="-march=native -msse4.2 -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field -Wno-padded -Wno-unused-template -Wno-missing-variable-declarations -Wno-float-equal -Wconversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-exit-time-destructors"
+ $(MAKE) CC=clang++-13 LD=clang++-13 OBJ=obj/clang CEXTRAFLAGS="-march=native \
+ -mllvm -inline-threshold=2000 \
+ -Wunknown-warning-option \
+ -Weverything -Wall -pedantic -Wpedantic \
+ -Werror -Wno-padded -Wno-weak-vtables -Wno-weak-template-vtables -Wunused-template \
+ -Wno-float-equal \
+ -Wno-c++98-compat -Wno-c++98-compat-pedantic \
+ -Wno-exit-time-destructors \
+ -Wno-undefined-reinterpret-cast -Wno-error=unused-macros \
+ -Wno-error=deprecated"
+
+clang-libc:
+ #clang-11 currently broken
+ #$(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang CEXTRAFLAGS="-march=native
+ $(MAKE) CC=clang++-13 LD=clang++-13 OBJ=obj/clang-libc CEXTRAFLAGS="-march=native \
+ -stdlib=libc++ -mllvm -inline-threshold=2000 \
+ -Wunknown-warning-option \
+ -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field \
+ -Werror -Wno-padded -Wno-weak-vtables -Wno-weak-template-vtables -Wunused-template \
+ -Wmissing-variable-declarations -Wno-float-equal -Wconversion \
+ -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wformat-nonliteral \
+ -Wno-exit-time-destructors -Winconsistent-missing-destructor-override \
+ -Wno-undefined-reinterpret-cast \
+ -Wunreachable-code \
+ -Wmissing-prototypes" \
+ LDEXTRAFLAGS=-stdlib=libc++
nvcc:
- $(MAKE) CC=/usr/local/cuda-9.0/bin/nvcc LD=/usr/local/cuda-9.2/bin/nvcc \
- CEXTRAFLAGS="-x cu -DNVCCBUILD=1 --expt-extended-lambda --expt-relaxed-constexpr --default-stream per-thread --restrict"
+ $(MAKE) CC=/usr/local/cuda-11.3/bin/nvcc LD=/usr/local/cuda-11.3/bin/nvcc \
+ OBJ=obj/nvcc CEXTRAFLAGS="--std c++17 -x cu --expt-extended-lambda \
+ --expt-relaxed-constexpr --default-stream per-thread --restrict \
+ --ftemplate-depth 1024 \
+ -Xcompiler -O6 -Xcompiler -march=native -ccbin g++-9 " \
+ DEPENDCC=g++
-tidy_db: compile_commands_prefix $(ALL_TIDY_FILES) compile_commands_postfix
+mingw:
+ $(MAKE) CEXTRAFLAGS="-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 \
+ -DWIN32_LEAN_AND_MEAN" LDEXTRAFLAGS="-Wl,--subsystem,console \
+ -municode" LIBS= MD=@mkdir.exe SHELL=sh.exe DOXYGEN=doxygen.exe $(PARAMS)
+
+mingw-cross:
+ ${MAKE} CC="x86_64-w64-mingw32-g++-posix" LD="x86_64-w64-mingw32-g++-posix" \
+ CEXTRAFLAGS="-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN" \
+ LDEXTRAFLAGS="-Wl,--subsystem,console -municode" OBJ=obj/mingw-cross \
+ EXESUFFIX=.exe LIBS=
#
-# -Wno-c++11-narrowing : seems a bit broken
-# Mostly done: -Wno-weak-vtables -Wno-cast-align
-# FIXME: -Wno-weak-vtables -Wno-missing-variable-declarations -Wno-conversion -Wno-exit-time-destructors
-# FIXME: -Winconsistent-missing-destructor-override : c++ community has diverging opinions on this https://github.com/isocpp/CppCoreGuidelines/issues/721
-# FIXME: -Wunreachable-code : False warnings, this a documented clang bug: https://llvm.org/bugs/show_bug.cgi?id=28994
-# -Wweak-template-vtables
+# run with emrun --browser chrome nltool.html -c run -t 10 -n kidniki nl_kidniki.cpp
#
-# These have to be given:
-# -Wno-missing-variable-declarations : Device factory code, on purpose
+emsdk:
+ emmake $(MAKE) CC=emcc LD=emcc CEXTRAFLAGS="-fexceptions -msimd128" LDEXTRAFLAGS="-s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=268435456 -fexceptions -msimd128 --emrun --embed-file ../../../mame/machine/nl_pongf.cpp@nl_pongf.cpp --embed-file ../../../mame/audio/nl_kidniki.cpp@nl_kidniki.cpp" OBJ=obj/emsdk EXESUFFIX=.html
+ # LDFLAGS -s ASSERTIONS=1
-mingw:
- $(MAKE) CEXTRAFLAGS="-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN" \
- LDEXTRAFLAGS="-Wl,--subsystem,console -municode" LIBS= MD=@mkdir.exe SHELL=sh.exe
-#
-# FIXME: Unicode
-# CEXTRAFLAGS = -DUNICODE -D_UNICODE -municode
-# LDEXTRAFLAGS = -municode
-#
+#-------------------------------------------------
+# regression tests
+#-------------------------------------------------
+
+runtests: $(TARGETS)
+ ./nltool$(EXESUFFIX) -c tests
+#-------------------------------------------------
+# man pages
+#-------------------------------------------------
+
+manpages: maketree $(TARGETS) man/nltool.1 man/nlwav.1 html/nltool.html html/nlwav.html
+
+#-------------------------------------------------
+# documentation
+#-------------------------------------------------
-doc: nltool
- ./nltool -c docheader > ../documentation/devsyn.dox.h
+doc:
+ ./nltool$(EXESUFFIX) -c docheader > ../documentation/devsyn.dox.h
$(DOXYGEN) doxygen.conf
+cspell:
+ #cd .. && cspell -c build/cspell.json --no-color --locale en-GB --relative $(patsubst $(SRC)/%, %, $(ALLHEADERS) ) | sed -e "s/ - Unknown/: error: Unknown/g"
+ cd .. && $(CSPELL) -c build/cspell.json --no-color --locale en-GB --relative $(patsubst $(SRC)/%, %, $(ALLHEADERS) $(ALLSOURCES)) | sed -e "s/ - Unknown/: error: Unknown/g"
+
#-------------------------------------------------
# depends
#-------------------------------------------------
-.depend: $(SOURCES)
- @echo creating .depend
- @rm -f ./.depend
- @for i in $(SOURCES); do \
- $(CC) $(CFLAGS) -MM $$i -MT `echo $$i | sed -e 's+$(SRC)+$(OBJ)+' -e 's+.cpp+.o+' ` >> ./.depend; \
- done
+.PHONY: depend
+depend: $(DEPEND)
-depend: .depend
+$(DEPEND): $(ALLSOURCES) | $(OBJ)
+ @echo creating $(DEPEND)
+ @$(RM) -f $(DEPEND)
+ @for i in $(ALLSOURCES); do \
+ $(DEPENDCC) $(CCOREFLAGS) -MM $$i -MT `echo $$i \
+ | sed -e 's+$(SRC)+$(OBJ)+' -e 's+.cpp+.o+' ` \
+ | sed -e 's_\.\./[a-z]*/\.\./_../_g' >> $(DEPEND); \
+ done
# Include only if the goal needs it
ifeq ($(filter $(MAKECMDGOALS),$(MAKEFILE_TARGETS_WITHOUT_INCLUDE)),)
--include .depend
+-include $(DEPEND)
endif
#-------------------------------------------------
+# generated
+#-------------------------------------------------
+
+$(SRC)/generated/lib_entries.hxx: create_lib_entries.py $(DEVSOURCES)
+ @echo creating $@
+ $(PYTHON) create_lib_entries.py $^ > $@
+
+$(SRC)/generated/nld_devinc.h: create_devinc.py $(DEVSOURCES)
+ @echo creating $@
+ $(PYTHON) create_devinc.py $^ > $@
+
+$(SRC)/generated/nlm_modules_lib.cpp: create_modules.py $(MODULESOURCES)
+ @echo creating $@
+ $(PYTHON) create_modules.py $^ > $@
+
+.PHONY: generated
+generated: $(SRC)/generated/lib_entries.hxx $(SRC)/generated/nld_devinc.h $(SRC)/generated/nlm_modules_lib.cpp
+
+#-------------------------------------------------
+# fix permissions, source management
+#-------------------------------------------------
+
+fix_permissions:
+ @find .. -executable -and -not -type d -print | grep -v /build | xargs -r chmod a-x
+ @chmod a-x $(ALLFILES)
+ @find .. -print | xargs setfacl -b
+
+srcclean: $(ALLSOURCES) $(ALLHEADERS)
+ @../../../../srcclean -u $(ALLSOURCES) $(ALLHEADERS)
+
+precommit: fix_permissions srcclean all runtests
+
+#-------------------------------------------------
# clang tidy
#-------------------------------------------------
+
+tidy_db: compile_commands_prefix $(ALL_TIDY_FILES) compile_commands_postfix
+
tidy: tidy_db
@echo running tidy
- @for i in $(SOURCES); do \
+ @for i in $(TIDY_SOURCES); do \
$(CLANG_TIDY) $$i $(TIDY_FLAGS) -header-filter=.*; \
done
-tidy_db: compile_commands_prefix $(ALL_TIDY_FILES) compile_commands_postfix
-
-
#-------------------------------------------------
# generic rules
#-------------------------------------------------
@@ -330,6 +466,14 @@ $(OBJ)/%.json: $(SRC)/%.cpp
@echo \"file\": \"$(CURDIR)/$<\" } >> $(TIDY_DB)
@echo "," >> $(TIDY_DB)
+man/%.1: %$(EXESUFFIX)
+ @echo Building $@...
+ @help2man --include=$*.help2man --no-info ./$< > $@
+
+html/%.html: man/%.1
+ @echo Building $@...
+ @groff -mandoc -Thtml $< > $@
+
compile_commands_prefix:
@echo "[" > $(TIDY_DB)
diff --git a/src/lib/netlist/build/man/nltool.1 b/src/lib/netlist/build/man/nltool.1
new file mode 100644
index 00000000000..ac1e7006794
--- /dev/null
+++ b/src/lib/netlist/build/man/nltool.1
@@ -0,0 +1,176 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3.
+.TH NLTOOL "1" "May 2022" "nltool (netlist) 0.14" "User Commands"
+.SH NAME
+nltool \- manual page for nltool (netlist) 0.14
+.SH SYNOPSIS
+.B nltool
+[\fI\,option\/\fR]... [\fI\,files\/\fR]...
+.SH DESCRIPTION
+nltool serves as the Swiss Army knife to run, test and convert netlists.
+.PP
+Commands may accept one or more files depending on the functionality.
+If no file is provided, standard input is used.
+.SH OPTIONS
+.SS "General options:"
+.IP
+The following options apply to all commands.
+.HP
+\fB\-c\fR, \fB\-\-cmd\fR=\fI\,run\/\fR|validate|convert|listdevices|listmodels|static|header|docheader|tests
+.IP
+run|validate|convert|listdevices|listmodels|static|header|docheader|tests
+.TP
+\fB\-I\fR, \fB\-\-include\fR=\fI\,Value\/\fR
+Add the directory to the list of directories to be
+searched for header files. This option may be
+specified repeatedly.
+.TP
+\fB\-D\fR, \fB\-\-define\fR=\fI\,Value\/\fR
+predefine value as macro, e.g. \fB\-Dname\fR=\fI\,value\/\fR. If
+\&'=value' is omitted predefine it as 1. This option
+may be specified repeatedly.
+.TP
+\fB\-r\fR, \fB\-\-rom\fR=\fI\,Value\/\fR
+where to look for data files
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+be verbose \- this produces lots of output
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+be quiet \- no warnings
+.TP
+\fB\-\-prepro\fR
+output preprocessor output to stderr
+.TP
+\fB\-\-progress\fR
+show progress bar on longer operations
+.TP
+\fB\-\-version\fR
+display version and exit
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+display help and exit
+.SS "Options for run and static commands:"
+.IP
+These options apply to run and static commands.
+.TP
+\fB\-n\fR, \fB\-\-name\fR=\fI\,Value\/\fR
+the netlist in file specified by \fB\-f\fR option to run;
+default is first one
+.SS "Options for static command:"
+.IP
+These options apply to static command.
+.TP
+\fB\-d\fR, \fB\-\-dir\fR=\fI\,Value\/\fR
+output directory for the generated files.
+.TP
+\fB\-o\fR, \fB\-\-output\fR=\fI\,Value\/\fR
+single output file for the generated code.
+Either \fB\-\-dir\fR or \fB\-\-output\fR can be specificied
+.TP
+\fB\-\-static_include\fR
+write static solvers to individual files included by
+file specified with \fB\-\-output\fR. \fB\-\-dir\fR must be path to
+"generated/static" path in netlist folder.
+.SS "Options for run command:"
+.IP
+These options are only used by the run command.
+.TP
+\fB\-t\fR, \fB\-\-time_to_run\fR=\fI\,Value\/\fR
+time to run the emulation (seconds)
+.TP
+\fB\-\-boost_lib\fR=\fI\,Value\/\fR
+generic: will use generic solvers.
+builtin: Use optimized solvers compiled in.
+somelib.so: Use library with precompiled solvers.
+.TP
+\fB\-s\fR, \fB\-\-statistics\fR
+gather runtime statistics
+.TP
+\fB\-l\fR, \fB\-\-log\fR=\fI\,Value\/\fR
+define terminal to log. This option may be specified
+repeatedly.
+.TP
+\fB\-i\fR, \fB\-\-input\fR=\fI\,Value\/\fR
+input file to process (default is none)
+.TP
+\fB\-\-loadstate\fR=\fI\,Value\/\fR
+load state from file and continue from there
+.TP
+\fB\-\-savestate\fR=\fI\,Value\/\fR
+save state to file at end of run
+.TP
+\fB\-\-fperr\fR
+raise exception on floating point errors. This is
+intended to be used during debugging.
+.SS "Options for convert command:"
+.IP
+These options are only used by the convert command.
+.TP
+\fB\-y\fR, \fB\-\-type\fR=\fI\,spice\/\fR|eagle|rinf
+type of file to be converted: spice,eagle,rinf
+.SS "Options for validate command:"
+.IP
+These options are only used by the validate command.
+.SS "Options for header command:"
+.IP
+These options are only used by the header command.
+.TP
+\fB\-\-tab\-width\fR=\fI\,Value\/\fR
+Tab width for output.
+.TP
+\fB\-\-line\-width\fR=\fI\,Value\/\fR
+Line width for output.
+.TP
+\fB\-\-pattern\fR=\fI\,Value\/\fR
+Pattern to match against device names. If the device
+name contains pattern, the device will be included
+in the output. Multiple patterns can be specified,
+if none is given, all devices will be output.
+.SH EXAMPLES
+nltool \-c run \-t 3.5 \-n cap_delay nl_examples/cdelay.c
+.IP
+Run netlist "cap_delay" from file nl_examples/cdelay.c for 3.5
+seconds
+.PP
+nltool \-\-cmd=listdevices
+.IP
+List all known devices.
+.PP
+nltool \-\-cmd=header \-\-tab\-width=8 \-\-line\-width=80
+.IP
+Create the header file needed for including netlists as code.
+.PP
+nltool \-\-cmd static \-\-output
+.IP
+src/lib/netlist/generated/static_solvers.cpp
+src/mame/audio/nl_*.cpp src/mame/machine/nl_*.cpp
+.IP
+Create static solvers for the MAME project using one single source
+file.
+.PP
+nltool \-\-cmd static \-\-output
+.IP
+src/lib/netlist/generated/static_solvers.cpp \-\-dir
+src/lib/netlist/generated/static \-\-static_include
+src/mame/audio/nl_*.cpp src/mame/machine/nl_*.cpp
+.IP
+Create static solvers for the MAME project using a single source
+file which includes generated solvers written to \-\-dir folder.
+.PP
+nltool \-\-cmd tests
+.IP
+Run unit tests. In case the unit tests are not linked in, this will
+do nothing.
+.SH AUTHOR
+Written by Couriersud.
+.SH COPYRIGHT
+Copyright \(co 2021 Couriersud
+License BSD\-3\-Clause
+.br
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+More documentation for the
+.B nltool
+program is available in doxygen format.
+
diff --git a/src/lib/netlist/build/man/nlwav.1 b/src/lib/netlist/build/man/nlwav.1
new file mode 100644
index 00000000000..11c63423809
--- /dev/null
+++ b/src/lib/netlist/build/man/nlwav.1
@@ -0,0 +1,116 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3.
+.TH NLWAV "1" "May 2022" "nlwav (netlist) 0.1" "User Commands"
+.SH NAME
+nlwav \- manual page for nlwav (netlist) 0.1
+.SH SYNOPSIS
+.B nlwav
+[\fI\,OPTION\/\fR] ... [\fI\,FILE\/\fR] ...
+.SH DESCRIPTION
+Convert netlist log files into wav files.
+.SH OPTIONS
+.TP
+\fB\-f\fR, \fB\-\-format\fR=\fI\,wav16s\/\fR|wav32s|wav32f|vcda|vcdd|tab
+output format. Available options are
+wav16s|wav32s|wav32f|vcda|vcdd|tab.
+.TP
+wav16s
+: multichannel wav output 16 bit signed
+.TP
+wav32s
+: multichannel wav output 32 bit signed
+.TP
+wav32f
+: multichannel wav output 32 bit float
+.TP
+vcda : analog VCD output
+vcdd : digital VCD output
+tab : sampled output
+Digital signals are created using the \fB\-\-high\fR and
+.IP
+\fB\-\-low\fR options
+.TP
+\fB\-o\fR, \fB\-\-output\fR=\fI\,Value\/\fR
+output file
+.SS "wav options:"
+.IP
+These options apply to wav output only
+.TP
+\fB\-r\fR, \fB\-\-rate\fR=\fI\,Value\/\fR
+sample rate of output file
+.TP
+\fB\-a\fR, \fB\-\-amp\fR=\fI\,Value\/\fR
+amplification after mean correction
+.TP
+\fB\-\-lowpass\fR=\fI\,Value\/\fR
+lowpass filter frequency.
+Default 20000 Hz.
+.TP
+\fB\-\-highpass\fR=\fI\,Value\/\fR
+highpass filter frequency.
+Default is 20 Hz.
+.TP
+\fB\-\-hpboost\fR
+enable highpass boost to filter out initial click.
+.SS "vcdd options:"
+.IP
+These options apply to vcdd output only
+.TP
+\fB\-u\fR, \fB\-\-high\fR=\fI\,Value\/\fR
+minimum input for high level
+.TP
+\fB\-l\fR, \fB\-\-low\fR=\fI\,Value\/\fR
+maximum input for low level
+.SS "tab options:"
+.IP
+These options apply to sampled output only
+.TP
+\fB\-s\fR, \fB\-\-start\fR=\fI\,Value\/\fR
+time when sampling starts
+.TP
+\fB\-i\fR, \fB\-\-increment\fR=\fI\,Value\/\fR
+time between samples
+.TP
+\fB\-n\fR, \fB\-\-samples\fR=\fI\,Value\/\fR
+number of samples
+.SS "General options:"
+.IP
+These options always apply
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+be verbose \- this produces lots of output
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+be quiet \- no warnings
+.TP
+\fB\-\-version\fR
+display version and exit
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+display help and exit
+.SH EXAMPLES
+\&./nlwav \-f vcdd \-o x.vcd log_V*
+.IP
+convert all files starting with "log_V" into a digital vcd file
+.PP
+\&./nlwav \-f wav16s \-o x.wav log_V*
+.IP
+convert all files starting with "log_V" into a multichannel wav file
+(16bit, signed)
+.PP
+\&./nlwav \-f tab \-o x.tab \-s 0.0000005 \-i 0.000001 \-n 256 log_BLUE.log
+.IP
+convert file log_BLUE.log to sampled output. First sample at 500ns
+followed by 255 samples every micro\-second.
+.SH AUTHOR
+Written by Couriersud.
+.SH COPYRIGHT
+Copyright \(co 2021 Couriersud
+License BSD\-3\-Clause
+.br
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+More documentation for the
+.B nlwav
+program is available in doxygen format.
+
diff --git a/src/lib/netlist/build/nltool.help2man b/src/lib/netlist/build/nltool.help2man
new file mode 100644
index 00000000000..76b0f15b8d0
--- /dev/null
+++ b/src/lib/netlist/build/nltool.help2man
@@ -0,0 +1,5 @@
+[see also]
+More documentation for the
+.B nltool
+program is available in doxygen format.
+
diff --git a/src/lib/netlist/build/nlwav.help2man b/src/lib/netlist/build/nlwav.help2man
new file mode 100644
index 00000000000..9d1c78b5139
--- /dev/null
+++ b/src/lib/netlist/build/nlwav.help2man
@@ -0,0 +1,5 @@
+[see also]
+More documentation for the
+.B nlwav
+program is available in doxygen format.
+