summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-09-12 22:21:19 +0200
committer couriersud <couriersud@gmx.org>2020-09-12 22:55:32 +0200
commit297d12d053bcee9284838e2f6ae943fc2b21b38d (patch)
tree3a73bb18b11d8434ae34d4e77d72d12849ae885d
parente0bbe69aca499462a352a0827b17031884266fdf (diff)
netlist: Add documentation how to add devices.
* please refer to adding_devices.md for instructions how to add devices to netlist * also fixed VS build * fix a makefile bug. * removed more obsolete include files
-rw-r--r--src/lib/netlist/adding_devices.md82
-rw-r--r--src/lib/netlist/analog/nld_bjt.h25
-rw-r--r--src/lib/netlist/analog/nld_fourterm.h32
-rw-r--r--src/lib/netlist/analog/nld_mosfet.h21
-rw-r--r--src/lib/netlist/analog/nld_opamps.cpp1
-rw-r--r--src/lib/netlist/analog/nld_opamps.h22
-rw-r--r--src/lib/netlist/analog/nld_switches.h23
-rw-r--r--src/lib/netlist/analog/nld_twoterm.h47
-rw-r--r--src/lib/netlist/build/makefile2
-rwxr-xr-xsrc/lib/netlist/buildVS/netlistlib.vcxproj2
-rwxr-xr-xsrc/lib/netlist/buildVS/netlistlib.vcxproj.filters6
-rwxr-xr-x[-rw-r--r--]src/lib/netlist/generated/nlm_modules_lib.cpp2
-rw-r--r--src/lib/netlist/nl_config.h2
-rw-r--r--src/lib/netlist/nl_setup.cpp1
14 files changed, 93 insertions, 175 deletions
diff --git a/src/lib/netlist/adding_devices.md b/src/lib/netlist/adding_devices.md
new file mode 100644
index 00000000000..808ce9a2568
--- /dev/null
+++ b/src/lib/netlist/adding_devices.md
@@ -0,0 +1,82 @@
+# Adding devices to netlist
+
+There are basically two kind of devices you can add to netlist:
+
+- coded devices. These can be found in the devices and analog folder. Typically
+these are logic or elementary (i.e. resistor, capacitor) devices.
+- netlist language devices. These are found in the macro folder structure.
+Typically these are dip layouts or devices consisting of elementary devices. A good
+example are operational amplifier models or VCOs.
+
+In prior netlist releases (<=0.13.0) it was cumbersome to add devices. You had to make
+sure to add references and code in a number of different locations.
+
+All necessary header files are now created automatically.
+
+## Stand alone compilation
+
+### Coded devices
+
+Just add your device code (e.g. nld_device.cpp) into the devices folder.
+
+Switch to the `build` directory
+
+`cd build`
+
+and type
+
+`make generated`
+
+to create all the infrastructure code.
+
+### Macro devices
+
+Place the device code (e.g. nlmod_device.cpp) into macro/modules.
+
+Switch to the `build` directory
+
+`cd build`
+
+and type
+
+`make generated`
+
+to create all the infrastructure code.
+
+## Visual Studio build
+
+You need to add the files manually to the Visual Studio solution.
+
+## MAME integration
+
+In addition to the the steps above you have to add your code additions to the
+`scripts/src/netlist.lua` file.
+
+Make sure to
+
+```sh
+cd src/lib/netlist/build
+make generated
+```
+
+to (re)create the necessary files in the `generated` directory.
+
+## Background
+
+### What does `make generated` do?
+
+`make generated` calls three python scripts:
+
+- `create_devinc.py`
+- `create_lib_entries.py`
+- `create_modules.py`
+
+which create the following files in the `generated` directory:
+
+- `nld_devinc.h`
+- `lib_entries.hxx`
+- `nlm_modules_lib.cpp`
+
+The information contained in these files in the past had to be included in various places
+and files previously. Since the information can be extracted programmatically the
+manual process now was replaced.
diff --git a/src/lib/netlist/analog/nld_bjt.h b/src/lib/netlist/analog/nld_bjt.h
deleted file mode 100644
index 2dd12ea82d8..00000000000
--- a/src/lib/netlist/analog/nld_bjt.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Couriersud
-
-#ifndef NLD_BJT_H_
-#define NLD_BJT_H_
-
-///
-/// \file nld_bjt.h
-///
-
-#include "../nl_setup.h"
-
-// -----------------------------------------------------------------------------
-// Macros
-// -----------------------------------------------------------------------------
-
-#define QBJT_SW(name, model) \
- NET_REGISTER_DEV(QBJT_SW, name) \
- NETDEV_PARAMI(name, MODEL, model)
-
-#define QBJT_EB(name, model) \
- NET_REGISTER_DEV(QBJT_EB, name) \
- NETDEV_PARAMI(name, MODEL, model)
-
-#endif // NLD_BJT_H_
diff --git a/src/lib/netlist/analog/nld_fourterm.h b/src/lib/netlist/analog/nld_fourterm.h
deleted file mode 100644
index 12fb0035d29..00000000000
--- a/src/lib/netlist/analog/nld_fourterm.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Couriersud
-
-#ifndef NLD_FOURTERM_H_
-#define NLD_FOURTERM_H_
-
-///
-/// \file nld_fourterm.h
-///
-
-#include "../nl_setup.h"
-
-// ----------------------------------------------------------------------------------------
-// Macros
-// ----------------------------------------------------------------------------------------
-
-#define VCCS(name, G) \
- NET_REGISTER_DEVEXT(VCCS, name, G)
-
-#define CCCS(name, G) \
- NET_REGISTER_DEVEXT(CCCS, name, G)
-
-#define VCVS(name, G) \
- NET_REGISTER_DEVEXT(VCVS, name, G)
-
-#define CCVS(name, G) \
- NET_REGISTER_DEVEXT(CCVS, name, G)
-
-#define LVCCS(name) \
- NET_REGISTER_DEV(LVCCS, name)
-
-#endif // NLD_FOURTERM_H_
diff --git a/src/lib/netlist/analog/nld_mosfet.h b/src/lib/netlist/analog/nld_mosfet.h
deleted file mode 100644
index 38e7a91c339..00000000000
--- a/src/lib/netlist/analog/nld_mosfet.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Couriersud
-
-#ifndef NLD_MOSFET_H_
-#define NLD_MOSFET_H_
-
-#include "../nl_setup.h"
-
-///
-/// \file nld_mosfet.h
-///
-
-// -----------------------------------------------------------------------------
-// Macros
-// -----------------------------------------------------------------------------
-
-#define MOSFET(name, model) \
- NET_REGISTER_DEV(MOSFET, name) \
- NETDEV_PARAMI(name, MODEL, model)
-
-#endif // NLD_MOSFET_H_
diff --git a/src/lib/netlist/analog/nld_opamps.cpp b/src/lib/netlist/analog/nld_opamps.cpp
index b3d9b868a48..433f6d46297 100644
--- a/src/lib/netlist/analog/nld_opamps.cpp
+++ b/src/lib/netlist/analog/nld_opamps.cpp
@@ -1,7 +1,6 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-#include "nld_opamps.h"
#include "nl_base.h"
#include "nl_errstr.h"
#include "nlid_fourterm.h"
diff --git a/src/lib/netlist/analog/nld_opamps.h b/src/lib/netlist/analog/nld_opamps.h
deleted file mode 100644
index dcef1f84f03..00000000000
--- a/src/lib/netlist/analog/nld_opamps.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Couriersud
-
-#ifndef NLD_OPAMPS_H_
-#define NLD_OPAMPS_H_
-
-///
-/// \file nld_opamps.h
-///
-
-#include "../nl_setup.h"
-
-// ----------------------------------------------------------------------------------------
-// Macros
-// ----------------------------------------------------------------------------------------
-
-#define OPAMP(name, model) \
- NET_REGISTER_DEV(OPAMP, name) \
- NETDEV_PARAMI(name, MODEL, model)
-
-
-#endif // NLD_OPAMPS_H_
diff --git a/src/lib/netlist/analog/nld_switches.h b/src/lib/netlist/analog/nld_switches.h
deleted file mode 100644
index cab638402f1..00000000000
--- a/src/lib/netlist/analog/nld_switches.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Couriersud
-
-#ifndef NLD_SWITCHES_H_
-#define NLD_SWITCHES_H_
-
-///
-/// \file nld_switches.h
-///
-
-#include "../nl_setup.h"
-
-// ----------------------------------------------------------------------------------------
-// Macros
-// ----------------------------------------------------------------------------------------
-
-#define SWITCH(name) \
- NET_REGISTER_DEV(SWITCH, name)
-
-#define SWITCH2(name) \
- NET_REGISTER_DEV(SWITCH2, name)
-
-#endif // NLD_SWITCHES_H_
diff --git a/src/lib/netlist/analog/nld_twoterm.h b/src/lib/netlist/analog/nld_twoterm.h
deleted file mode 100644
index f4a18898818..00000000000
--- a/src/lib/netlist/analog/nld_twoterm.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Couriersud
-
-#ifndef NLD_TWOTERM_H_
-#define NLD_TWOTERM_H_
-
-///
-/// \file nld_twoterm.h
-///
-
-#include "../nl_setup.h"
-
-// -----------------------------------------------------------------------------
-// Macros
-// -----------------------------------------------------------------------------
-
-#define RES(name, p_R) \
- NET_REGISTER_DEVEXT(RES, name, p_R)
-
-#define POT(name, p_R) \
- NET_REGISTER_DEVEXT(POT, name, p_R)
-
-// Does not have pin 3 connected
-#define POT2(name, p_R) \
- NET_REGISTER_DEVEXT(POT2, name, p_R)
-
-#define CAP(name, p_C) \
- NET_REGISTER_DEVEXT(CAP, name, p_C)
-
-#define IND(name, p_L) \
- NET_REGISTER_DEVEXT(IND, name, p_L)
-
-// Generic Diode
-#define DIODE(name, model) \
- NET_REGISTER_DEVEXT(DIODE, name, model)
-
-// Generic Zener Diode
-#define ZDIODE(name, model) \
- NET_REGISTER_DEVEXT(ZDIODE, name, model)
-
-#define VS(name, pV) \
- NET_REGISTER_DEVEXT(VS, name, pV)
-
-#define CS(name, pI) \
- NET_REGISTER_DEVEXT(CS, name, pI)
-
-#endif // NLD_TWOTERM_H_
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile
index 4a877dac259..a324acb463b 100644
--- a/src/lib/netlist/build/makefile
+++ b/src/lib/netlist/build/makefile
@@ -370,7 +370,7 @@ $(SRC)/generated/nlm_modules_lib.cpp: $(MODULESOURCES)
$(PYTHON) create_modules.py $^ > $@
.PHONY: generated
-generated: ../generated/lib_entries.hxx ../generated/nld_devinc.h
+generated: $(SRC)/generated/lib_entries.hxx $(SRC)/generated/nld_devinc.h $(SRC)/generated/nlm_modules_lib.cpp
#-------------------------------------------------
# clang tidy
diff --git a/src/lib/netlist/buildVS/netlistlib.vcxproj b/src/lib/netlist/buildVS/netlistlib.vcxproj
index 70df3723f29..543d7680f29 100755
--- a/src/lib/netlist/buildVS/netlistlib.vcxproj
+++ b/src/lib/netlist/buildVS/netlistlib.vcxproj
@@ -174,7 +174,9 @@
<ClCompile Include="..\devices\nld_tristate.cpp" />
<ClCompile Include="..\devices\nlid_proxy.cpp" />
<ClCompile Include="..\devices\nlid_truthtable.cpp" />
+ <ClCompile Include="..\generated\nlm_modules_lib.cpp" />
<ClCompile Include="..\generated\static_solvers.cpp" />
+ <ClCompile Include="..\macro\modules\nlmod_RTEST.cpp" />
<ClCompile Include="..\macro\nlm_base_lib.cpp" />
<ClCompile Include="..\macro\nlm_cd4xxx_lib.cpp" />
<ClCompile Include="..\macro\nlm_opamp_lib.cpp" />
diff --git a/src/lib/netlist/buildVS/netlistlib.vcxproj.filters b/src/lib/netlist/buildVS/netlistlib.vcxproj.filters
index 96701bf2ae3..f858a2b9932 100755
--- a/src/lib/netlist/buildVS/netlistlib.vcxproj.filters
+++ b/src/lib/netlist/buildVS/netlistlib.vcxproj.filters
@@ -288,6 +288,12 @@
<ClCompile Include="..\devices\nld_9321.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\generated\nlm_modules_lib.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\macro\modules\nlmod_RTEST.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\nl_errstr.h">
diff --git a/src/lib/netlist/generated/nlm_modules_lib.cpp b/src/lib/netlist/generated/nlm_modules_lib.cpp
index 93f09c9da07..d9fe63979d9 100644..100755
--- a/src/lib/netlist/generated/nlm_modules_lib.cpp
+++ b/src/lib/netlist/generated/nlm_modules_lib.cpp
@@ -1,7 +1,7 @@
// license:CC0
// copyright-holders:Couriersud
-// File programmatically created Sat Sep 12 00:46:33 2020
+// File programmatically created Sat Sep 12 14:42:49 2020
#include "devices/net_lib.h"
diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h
index 4ffba2364fd..6d4c572eb08 100644
--- a/src/lib/netlist/nl_config.h
+++ b/src/lib/netlist/nl_config.h
@@ -19,7 +19,7 @@
///
/// \brief Version - Minor.
///
-#define NL_VERSION_MINOR 13
+#define NL_VERSION_MINOR 14
/// \brief Version - Patch level.
///
#define NL_VERSION_PATCHLEVEL 0
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index d4b3de2c0fb..b2ade9d48ce 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -2,7 +2,6 @@
// copyright-holders:Couriersud
#include "plib/palloc.h"
-#include "analog/nld_twoterm.h"
#include "core/setup.h"
#include "devices/nlid_proxy.h"
#include "devices/nlid_truthtable.h"