summaryrefslogtreecommitdiffstats
path: root/src/lib/netlist/devices
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/devices')
-rw-r--r--src/lib/netlist/devices/net_lib.cpp281
-rw-r--r--src/lib/netlist/devices/net_lib.h46
-rw-r--r--src/lib/netlist/devices/nld_2102A.cpp8
-rw-r--r--src/lib/netlist/devices/nld_2102A.h2
-rw-r--r--src/lib/netlist/devices/nld_2716.cpp6
-rw-r--r--src/lib/netlist/devices/nld_2716.h2
-rw-r--r--src/lib/netlist/devices/nld_4020.cpp7
-rw-r--r--src/lib/netlist/devices/nld_4020.h2
-rw-r--r--src/lib/netlist/devices/nld_4066.cpp37
-rw-r--r--src/lib/netlist/devices/nld_4066.h2
-rw-r--r--src/lib/netlist/devices/nld_4316.cpp18
-rw-r--r--src/lib/netlist/devices/nld_4316.h2
-rw-r--r--src/lib/netlist/devices/nld_74107.cpp20
-rw-r--r--src/lib/netlist/devices/nld_74107.h2
-rw-r--r--src/lib/netlist/devices/nld_74123.cpp26
-rw-r--r--src/lib/netlist/devices/nld_74123.h2
-rw-r--r--src/lib/netlist/devices/nld_74153.cpp12
-rw-r--r--src/lib/netlist/devices/nld_74153.h2
-rw-r--r--src/lib/netlist/devices/nld_74161.cpp8
-rw-r--r--src/lib/netlist/devices/nld_74161.h2
-rw-r--r--src/lib/netlist/devices/nld_74164.cpp6
-rw-r--r--src/lib/netlist/devices/nld_74164.h2
-rw-r--r--src/lib/netlist/devices/nld_74165.cpp7
-rw-r--r--src/lib/netlist/devices/nld_74165.h2
-rw-r--r--src/lib/netlist/devices/nld_74166.cpp6
-rw-r--r--src/lib/netlist/devices/nld_74166.h2
-rw-r--r--src/lib/netlist/devices/nld_74174.cpp6
-rw-r--r--src/lib/netlist/devices/nld_74174.h2
-rw-r--r--src/lib/netlist/devices/nld_74175.cpp6
-rw-r--r--src/lib/netlist/devices/nld_74175.h2
-rw-r--r--src/lib/netlist/devices/nld_74192.cpp8
-rw-r--r--src/lib/netlist/devices/nld_74192.h2
-rw-r--r--src/lib/netlist/devices/nld_74193.cpp8
-rw-r--r--src/lib/netlist/devices/nld_74193.h2
-rw-r--r--src/lib/netlist/devices/nld_74194.cpp6
-rw-r--r--src/lib/netlist/devices/nld_74194.h2
-rw-r--r--src/lib/netlist/devices/nld_74365.cpp14
-rw-r--r--src/lib/netlist/devices/nld_74365.h2
-rw-r--r--src/lib/netlist/devices/nld_7448.cpp24
-rw-r--r--src/lib/netlist/devices/nld_7448.h2
-rw-r--r--src/lib/netlist/devices/nld_7450.cpp18
-rw-r--r--src/lib/netlist/devices/nld_7450.h2
-rw-r--r--src/lib/netlist/devices/nld_7473.cpp10
-rw-r--r--src/lib/netlist/devices/nld_7473.h2
-rw-r--r--src/lib/netlist/devices/nld_7474.cpp132
-rw-r--r--src/lib/netlist/devices/nld_7474.h2
-rw-r--r--src/lib/netlist/devices/nld_7475.cpp12
-rw-r--r--src/lib/netlist/devices/nld_7475.h2
-rw-r--r--src/lib/netlist/devices/nld_7483.cpp47
-rw-r--r--src/lib/netlist/devices/nld_7483.h2
-rw-r--r--src/lib/netlist/devices/nld_7485.cpp6
-rw-r--r--src/lib/netlist/devices/nld_7485.h2
-rw-r--r--src/lib/netlist/devices/nld_7490.cpp35
-rw-r--r--src/lib/netlist/devices/nld_7490.h2
-rw-r--r--src/lib/netlist/devices/nld_7493.cpp87
-rw-r--r--src/lib/netlist/devices/nld_7493.h2
-rw-r--r--src/lib/netlist/devices/nld_7497.cpp174
-rw-r--r--src/lib/netlist/devices/nld_7497.h57
-rw-r--r--src/lib/netlist/devices/nld_74ls629.cpp19
-rw-r--r--src/lib/netlist/devices/nld_74ls629.h2
-rw-r--r--src/lib/netlist/devices/nld_82S115.cpp6
-rw-r--r--src/lib/netlist/devices/nld_82S115.h2
-rw-r--r--src/lib/netlist/devices/nld_82S123.cpp6
-rw-r--r--src/lib/netlist/devices/nld_82S123.h2
-rw-r--r--src/lib/netlist/devices/nld_82S126.cpp6
-rw-r--r--src/lib/netlist/devices/nld_82S126.h2
-rw-r--r--src/lib/netlist/devices/nld_82S16.cpp73
-rw-r--r--src/lib/netlist/devices/nld_82S16.h2
-rw-r--r--src/lib/netlist/devices/nld_9310.cpp42
-rw-r--r--src/lib/netlist/devices/nld_9310.h2
-rw-r--r--src/lib/netlist/devices/nld_9316.cpp138
-rw-r--r--src/lib/netlist/devices/nld_9316.h2
-rw-r--r--src/lib/netlist/devices/nld_9322.cpp14
-rw-r--r--src/lib/netlist/devices/nld_9322.h2
-rw-r--r--src/lib/netlist/devices/nld_am2847.cpp10
-rw-r--r--src/lib/netlist/devices/nld_am2847.h2
-rw-r--r--src/lib/netlist/devices/nld_dm9314.cpp6
-rw-r--r--src/lib/netlist/devices/nld_dm9314.h2
-rw-r--r--src/lib/netlist/devices/nld_dm9334.cpp6
-rw-r--r--src/lib/netlist/devices/nld_dm9334.h2
-rw-r--r--src/lib/netlist/devices/nld_legacy.cpp10
-rw-r--r--src/lib/netlist/devices/nld_legacy.h2
-rw-r--r--src/lib/netlist/devices/nld_log.cpp18
-rw-r--r--src/lib/netlist/devices/nld_log.h4
-rw-r--r--src/lib/netlist/devices/nld_mm5837.cpp16
-rw-r--r--src/lib/netlist/devices/nld_mm5837.h2
-rw-r--r--src/lib/netlist/devices/nld_ne555.cpp101
-rw-r--r--src/lib/netlist/devices/nld_ne555.h8
-rw-r--r--src/lib/netlist/devices/nld_r2r_dac.cpp14
-rw-r--r--src/lib/netlist/devices/nld_r2r_dac.h2
-rw-r--r--src/lib/netlist/devices/nld_schmitt.cpp30
-rw-r--r--src/lib/netlist/devices/nld_schmitt.h2
-rw-r--r--src/lib/netlist/devices/nld_system.cpp95
-rw-r--r--src/lib/netlist/devices/nld_system.h2
-rw-r--r--src/lib/netlist/devices/nld_tms4800.cpp10
-rw-r--r--src/lib/netlist/devices/nld_tms4800.h2
-rw-r--r--src/lib/netlist/devices/nld_tristate.cpp6
-rw-r--r--src/lib/netlist/devices/nld_tristate.h2
-rw-r--r--src/lib/netlist/devices/nlid_cmos.h4
-rw-r--r--src/lib/netlist/devices/nlid_proxy.cpp54
-rw-r--r--src/lib/netlist/devices/nlid_proxy.h24
-rw-r--r--src/lib/netlist/devices/nlid_system.h92
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.cpp141
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.h175
104 files changed, 1082 insertions, 1274 deletions
diff --git a/src/lib/netlist/devices/net_lib.cpp b/src/lib/netlist/devices/net_lib.cpp
index c0353f2489a..e0f0277daac 100644
--- a/src/lib/netlist/devices/net_lib.cpp
+++ b/src/lib/netlist/devices/net_lib.cpp
@@ -9,159 +9,152 @@
****************************************************************************/
#include "net_lib.h"
-#include "netlist/nl_factory.h"
-#include "netlist/solver/nld_solver.h"
+#include "../nl_factory.h"
+#include "../solver/nld_solver.h"
#define xstr(s) # s
-#define NETLIB_DEVICE_DECL(chip) extern factory::constructor_ptr_t decl_ ## chip
+#define NETLIB_DEVICE_DECL(chip) extern factory::constructor_ptr_t decl_ ## chip;
-#define LIB_DECL(nic, decl) factory.register_device( decl ( pstring(xstr(nic))) );
-#define LIB_ENTRY(nic) { NETLIB_DEVICE_DECL(nic); LIB_DECL(NETLIB_NAME(nic), decl_ ## nic) }
+#define ENTRYX1(nic, name, defparam, decl) factory.register_device( decl (pstring(# name), pstring(xstr(nic)), pstring(defparam)) );
+#define ENTRYX(nic, name, defparam) { NETLIB_DEVICE_DECL(nic) ENTRYX1(NETLIB_NAME(nic), name, defparam, decl_ ## nic) }
namespace netlist
{
-namespace devices
-{
-
- void initialize_factory(factory::list_t &factory)
+ namespace devices
{
- LIB_ENTRY(R)
- LIB_ENTRY(POT)
- LIB_ENTRY(POT2)
- LIB_ENTRY(C)
- LIB_ENTRY(L)
- LIB_ENTRY(D)
- LIB_ENTRY(VS)
- LIB_ENTRY(CS)
- LIB_ENTRY(VCVS)
- LIB_ENTRY(VCCS)
- LIB_ENTRY(CCCS)
- LIB_ENTRY(LVCCS)
- LIB_ENTRY(opamp)
- LIB_ENTRY(dummy_input)
- LIB_ENTRY(frontier) // not intended to be used directly
- LIB_ENTRY(function) // only for macro devices - NO FEEDBACK loops
- LIB_ENTRY(QBJT_EB)
- LIB_ENTRY(QBJT_switch)
- LIB_ENTRY(MOSFET)
- LIB_ENTRY(logic_input_ttl)
- LIB_ENTRY(logic_input)
- LIB_ENTRY(analog_input)
- LIB_ENTRY(log)
- LIB_ENTRY(logD)
- LIB_ENTRY(clock)
- LIB_ENTRY(extclock)
- LIB_ENTRY(mainclock)
- LIB_ENTRY(gnd)
- LIB_ENTRY(netlistparams)
- LIB_ENTRY(solver)
- LIB_ENTRY(res_sw)
- LIB_ENTRY(switch1)
- LIB_ENTRY(switch2)
- LIB_ENTRY(nicRSFF)
- LIB_ENTRY(nicDelay)
- LIB_ENTRY(2102A)
- LIB_ENTRY(2102A_dip)
- LIB_ENTRY(2716)
- LIB_ENTRY(2716_dip)
- LIB_ENTRY(7448)
- LIB_ENTRY(7448_dip)
- LIB_ENTRY(7450)
- LIB_ENTRY(7450_dip)
- LIB_ENTRY(7473)
- LIB_ENTRY(7473_dip)
- LIB_ENTRY(7473A)
- LIB_ENTRY(7473A_dip)
- LIB_ENTRY(7474)
- LIB_ENTRY(7474_dip)
- LIB_ENTRY(7475)
- LIB_ENTRY(7475_dip)
- LIB_ENTRY(7477)
- LIB_ENTRY(7477_dip)
- LIB_ENTRY(7483)
- LIB_ENTRY(7483_dip)
- LIB_ENTRY(7485)
- LIB_ENTRY(7485_dip)
- LIB_ENTRY(7490)
- LIB_ENTRY(7490_dip)
- LIB_ENTRY(7493)
- LIB_ENTRY(7493_dip)
- LIB_ENTRY(7497)
- LIB_ENTRY(7497_dip)
- LIB_ENTRY(74107)
- LIB_ENTRY(74107_dip)
- LIB_ENTRY(74107A) // FIXME: implement missing DIP
- LIB_ENTRY(74123)
- LIB_ENTRY(74123_dip)
- LIB_ENTRY(74153)
- LIB_ENTRY(74153_dip)
- LIB_ENTRY(74161)
- LIB_ENTRY(74161_dip)
- LIB_ENTRY(74164)
- LIB_ENTRY(74164_dip)
- LIB_ENTRY(74165)
- LIB_ENTRY(74165_dip)
- LIB_ENTRY(74166)
- LIB_ENTRY(74166_dip)
- LIB_ENTRY(74174)
- LIB_ENTRY(74175)
- LIB_ENTRY(74192)
- LIB_ENTRY(74193)
- LIB_ENTRY(74194)
- LIB_ENTRY(74365)
- //ENTRY(74279, TTL_74279, "") // only dip available
- LIB_ENTRY(SN74LS629)
- LIB_ENTRY(82S16)
- LIB_ENTRY(82S115)
- LIB_ENTRY(82S123)
- LIB_ENTRY(82S126)
- LIB_ENTRY(9310)
- LIB_ENTRY(9314)
- LIB_ENTRY(9316)
- LIB_ENTRY(9322)
- LIB_ENTRY(9334)
- LIB_ENTRY(AM2847)
- // FIXME: duplicate?
- LIB_ENTRY(CD4020_WI)
- LIB_ENTRY(CD4020)
- LIB_ENTRY(CD4066_GATE)
- LIB_ENTRY(CD4316_GATE)
- LIB_ENTRY(4538_dip)
- LIB_ENTRY(schmitt_trigger)
- /* entries with suffix WI are legacy only */
- //ENTRY(4066, CD_4066, "+A,B")
- LIB_ENTRY(NE555)
- LIB_ENTRY(NE555_dip)
- LIB_ENTRY(MC1455P)
- LIB_ENTRY(MC1455P_dip)
- LIB_ENTRY(TMS4800)
- LIB_ENTRY(TMS4800_dip)
- LIB_ENTRY(r2r_dac)
- LIB_ENTRY(tristate)
- LIB_ENTRY(tristate3)
- LIB_ENTRY(74174_dip)
- LIB_ENTRY(74175_dip)
- LIB_ENTRY(74192_dip)
- LIB_ENTRY(74193_dip)
- LIB_ENTRY(74194_dip)
- LIB_ENTRY(74365_dip)
- LIB_ENTRY(82S16_dip)
- LIB_ENTRY(82S115_dip)
- LIB_ENTRY(82S123_dip)
- LIB_ENTRY(82S126_dip)
- LIB_ENTRY(9602_dip)
- LIB_ENTRY(9310_dip)
- LIB_ENTRY(9314_dip)
- LIB_ENTRY(9316_dip)
- LIB_ENTRY(9322_dip)
- LIB_ENTRY(9334_dip)
- LIB_ENTRY(AM2847_dip)
- LIB_ENTRY(SN74LS629_dip)
- LIB_ENTRY(MM5837_dip)
- }
+ void initialize_factory(factory::list_t &factory)
+{
+ ENTRYX(R, RES, "R")
+ ENTRYX(POT, POT, "R")
+ ENTRYX(POT2, POT2, "R")
+ ENTRYX(C, CAP, "C")
+ ENTRYX(L, IND, "L")
+ ENTRYX(D, DIODE, "MODEL")
+ ENTRYX(VS, VS, "V")
+ ENTRYX(CS, CS, "I")
+ ENTRYX(VCVS, VCVS, "")
+ ENTRYX(VCCS, VCCS, "")
+ ENTRYX(CCCS, CCCS, "")
+ ENTRYX(LVCCS, LVCCS, "")
+ ENTRYX(opamp, OPAMP, "MODEL")
+ ENTRYX(dummy_input, DUMMY_INPUT, "")
+ ENTRYX(frontier, FRONTIER_DEV, "+I,+G,+Q") // not intended to be used directly
+ ENTRYX(function, AFUNC, "N,FUNC") // only for macro devices - NO FEEDBACK loops
+ ENTRYX(QBJT_EB, QBJT_EB, "MODEL")
+ ENTRYX(QBJT_switch, QBJT_SW, "MODEL")
+ ENTRYX(logic_input, TTL_INPUT, "IN")
+ ENTRYX(logic_input, LOGIC_INPUT, "IN,FAMILY")
+ ENTRYX(analog_input, ANALOG_INPUT, "IN")
+ ENTRYX(log, LOG, "+I")
+ ENTRYX(logD, LOGD, "+I,+I2")
+ ENTRYX(clock, CLOCK, "FREQ")
+ ENTRYX(extclock, EXTCLOCK, "FREQ,PATTERN")
+ ENTRYX(mainclock, MAINCLOCK, "FREQ")
+ ENTRYX(gnd, GND, "")
+ ENTRYX(netlistparams, PARAMETER, "")
+ ENTRYX(solver, SOLVER, "FREQ")
+ ENTRYX(res_sw, RES_SWITCH, "+IN,+P1,+P2")
+ ENTRYX(switch1, SWITCH, "")
+ ENTRYX(switch2, SWITCH2, "")
+ ENTRYX(nicRSFF, NETDEV_RSFF, "")
+ ENTRYX(nicDelay, NETDEV_DELAY, "")
+ ENTRYX(2716, EPROM_2716, "+GQ,+EPQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10")
+ ENTRYX(TMS4800, ROM_TMS4800, "+AR,+OE1,+OE2,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10")
+ ENTRYX(2102A, RAM_2102A, "+CEQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+RWQ,+DI")
+ ENTRYX(7450, TTL_7450_ANDORINVERT, "+A,+B,+C,+D")
+ ENTRYX(7448, TTL_7448, "+A,+B,+C,+D,+LTQ,+BIQ,+RBIQ")
+ ENTRYX(7473, TTL_7473, "+CLK,+J,+K,+CLRQ")
+ ENTRYX(7473A, TTL_7473A, "+CLK,+J,+K,+CLRQ")
+ ENTRYX(7474, TTL_7474, "+CLK,+D,+CLRQ,+PREQ")
+ ENTRYX(7475, TTL_7475, "")
+ ENTRYX(7477, TTL_7477, "")
+ ENTRYX(7483, TTL_7483, "+A1,+A2,+A3,+A4,+B1,+B2,+B3,+B4,+C0")
+ ENTRYX(7485, TTL_7485, "+A0,+A1,+A2,+A3,+B0,+B1,+B2,+B3,+LTIN,+EQIN,+GTIN")
+ ENTRYX(7490, TTL_7490, "+A,+B,+R1,+R2,+R91,+R92")
+ ENTRYX(7493, TTL_7493, "+CLKA,+CLKB,+R1,+R2")
+ ENTRYX(74107, TTL_74107, "+CLK,+J,+K,+CLRQ")
+ ENTRYX(74107A, TTL_74107A, "+CLK,+J,+K,+CLRQ")
+ ENTRYX(74123, TTL_74123, "")
+ ENTRYX(74153, TTL_74153, "+C0,+C1,+C2,+C3,+A,+B,+G")
+ ENTRYX(74161, TTL_74161, "+A,+B,+C,+D,+CLRQ,+LOADQ,+CLK,+ENABLEP,+ENABLET")
+ ENTRYX(74164, TTL_74164, "+A,+B,+CLRQ,+CLK")
+ ENTRYX(74165, TTL_74165, "+CLK,+CLKINH,+SH_LDQ,+SER,+A,+B,+C,+D,+E,+F,+G,+H")
+ ENTRYX(74166, TTL_74166, "+CLK,+CLKINH,+SH_LDQ,+SER,+A,+B,+C,+D,+E,+F,+G,+H,+CLRQ")
+ ENTRYX(74174, TTL_74174, "+CLK,+D1,+D2,+D3,+D4,+D5,+D6,+CLRQ")
+ ENTRYX(74175, TTL_74175, "+CLK,+D1,+D2,+D3,+D4,+CLRQ")
+ ENTRYX(74192, TTL_74192, "+A,+B,+C,+D,+CLEAR,+LOADQ,+CU,+CD")
+ ENTRYX(74193, TTL_74193, "+A,+B,+C,+D,+CLEAR,+LOADQ,+CU,+CD")
+ ENTRYX(74194, TTL_74194, "+CLK,+S0,+S1,+SRIN,+A,+B,+C,+D,+SLIN,+CLRQ")
+ ENTRYX(74365, TTL_74365, "+G1Q,+G2Q,+A1,+A2,+A3,+A4,+A5,+A6")
+ //ENTRY(74279, TTL_74279, "") // only dip available
+ ENTRYX(SN74LS629, SN74LS629, "CAP")
+ ENTRYX(82S16, TTL_82S16, "")
+ ENTRYX(82S115, PROM_82S115, "+CE1Q,+CE2,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+STROBE")
+ ENTRYX(82S123, PROM_82S123, "+CEQ,+A0,+A1,+A2,+A3,+A4")
+ ENTRYX(82S126, PROM_82S126, "+CE1Q,+CE2Q,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7")
+ ENTRYX(9310, TTL_9310, "")
+ ENTRYX(9314, TTL_9314, "+EQ,+MRQ,+S0Q,+S1Q,+S2Q,+S3Q,+D0,+D1,+D2,+D3")
+ ENTRYX(9316, TTL_9316, "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D")
+ ENTRYX(9322, TTL_9322, "+SELECT,+A1,+B1,+A2,+B2,+A3,+B3,+A4,+B4,+STROBE")
+ ENTRYX(9334, TTL_9334, "+CQ,+EQ,+D,+A0,+A1,+A2")
+ ENTRYX(AM2847, TTL_AM2847, "+CP,+INA,+INB,+INC,+IND,+RCA,+RCB,+RCC,+RCD")
+ ENTRYX(CD4020, CD4020, "")
+ ENTRYX(CD4066_GATE, CD4066_GATE, "")
+ ENTRYX(CD4316_GATE, CD4316_GATE, "")
+ ENTRYX(schmitt_trigger, SCHMITT_TRIGGER, "MODEL")
+ /* entries with suffix WI are legacy only */
+ ENTRYX(CD4020, CD4020_WI, "+IP,+RESET,+VDD,+VSS")
+ //ENTRY(4066, CD_4066, "+A,B")
+ ENTRYX(NE555, NE555, "")
+ ENTRYX(r2r_dac, R2R_DAC, "VIN,R,N")
+ ENTRYX(tristate, TTL_TRISTATE, "+CEQ1,+D1,+CEQ2,+D2")
+ ENTRYX(tristate3, TTL_TRISTATE3, "")
+ ENTRYX(2102A_dip, RAM_2102A_DIP, "")
+ ENTRYX(2716_dip, EPROM_2716_DIP, "")
+ ENTRYX(tms4800_dip, ROM_TMS4800_DIP, "")
+ ENTRYX(4538_dip, CD4538_DIP, "")
+ ENTRYX(7448_dip, TTL_7448_DIP, "")
+ ENTRYX(7450_dip, TTL_7450_DIP, "")
+ ENTRYX(7473_dip, TTL_7473_DIP, "")
+ ENTRYX(7473A_dip, TTL_7473A_DIP, "")
+ ENTRYX(7474_dip, TTL_7474_DIP, "")
+ ENTRYX(7475_dip, TTL_7475_DIP, "")
+ ENTRYX(7477_dip, TTL_7477_DIP, "")
+ ENTRYX(7483_dip, TTL_7483_DIP, "")
+ ENTRYX(7485_dip, TTL_7485_DIP, "")
+ ENTRYX(7490_dip, TTL_7490_DIP, "")
+ ENTRYX(7493_dip, TTL_7493_DIP, "")
+ ENTRYX(74107_dip, TTL_74107_DIP, "")
+ ENTRYX(74123_dip, TTL_74123_DIP, "")
+ ENTRYX(74153_dip, TTL_74153_DIP, "")
+ ENTRYX(74161_dip, TTL_74161_DIP, "")
+ ENTRYX(74164_dip, TTL_74164_DIP, "")
+ ENTRYX(74165_dip, TTL_74165_DIP, "")
+ ENTRYX(74166_dip, TTL_74166_DIP, "")
+ ENTRYX(74174_dip, TTL_74174_DIP, "")
+ ENTRYX(74175_dip, TTL_74175_DIP, "")
+ ENTRYX(74192_dip, TTL_74192_DIP, "")
+ ENTRYX(74193_dip, TTL_74193_DIP, "")
+ ENTRYX(74194_dip, TTL_74194_DIP, "")
+ ENTRYX(74365_dip, TTL_74365_DIP, "")
+ ENTRYX(82S16_dip, TTL_82S16_DIP, "")
+ ENTRYX(82S115_dip, PROM_82S115_DIP, "")
+ ENTRYX(82S123_dip, PROM_82S123_DIP, "")
+ ENTRYX(82S126_dip, PROM_82S126_DIP, "")
+ ENTRYX(9602_dip, TTL_9602_DIP, "")
+ ENTRYX(9310_dip, TTL_9310_DIP, "")
+ ENTRYX(9314_dip, TTL_9314_DIP, "")
+ ENTRYX(9316_dip, TTL_9316_DIP, "")
+ ENTRYX(9322_dip, TTL_9322_DIP, "")
+ ENTRYX(9334_dip, TTL_9334_DIP, "")
+ ENTRYX(AM2847_dip, TTL_AM2847_DIP, "")
+ ENTRYX(SN74LS629_dip, SN74LS629_DIP, "1.CAP1,2.CAP2")
+ ENTRYX(NE555_dip, NE555_DIP, "")
+ ENTRYX(MM5837_dip, MM5837_DIP, "")
+}
-} //namespace devices
+ } //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h
index abf58ccee16..4dead624fc2 100644
--- a/src/lib/netlist/devices/net_lib.h
+++ b/src/lib/netlist/devices/net_lib.h
@@ -35,8 +35,18 @@
#include "nld_2102A.h"
#include "nld_2716.h"
+#include "nld_tms4800.h"
#include "nld_4020.h"
#include "nld_4066.h"
+#include "nld_7448.h"
+#include "nld_7450.h"
+#include "nld_7473.h"
+#include "nld_7474.h"
+#include "nld_7475.h"
+#include "nld_7483.h"
+#include "nld_7485.h"
+#include "nld_7490.h"
+#include "nld_7493.h"
#include "nld_74107.h"
#include "nld_74123.h"
#include "nld_74153.h"
@@ -50,32 +60,21 @@
#include "nld_74193.h"
#include "nld_74194.h"
#include "nld_74365.h"
-#include "nld_7448.h"
-#include "nld_7450.h"
-#include "nld_7473.h"
-#include "nld_7474.h"
-#include "nld_7475.h"
-#include "nld_7483.h"
-#include "nld_7485.h"
-#include "nld_7490.h"
-#include "nld_7493.h"
-#include "nld_7497.h"
#include "nld_74ls629.h"
+#include "nld_82S16.h"
#include "nld_82S115.h"
#include "nld_82S123.h"
#include "nld_82S126.h"
-#include "nld_82S16.h"
#include "nld_9310.h"
#include "nld_9316.h"
#include "nld_9322.h"
-#include "nld_tms4800.h"
#include "nld_am2847.h"
#include "nld_dm9314.h"
#include "nld_dm9334.h"
-#include "nld_mm5837.h"
#include "nld_ne555.h"
+#include "nld_mm5837.h"
#include "nld_r2r_dac.h"
@@ -85,17 +84,16 @@
#include "nld_log.h"
-#include "netlist/macro/nlm_cd4xxx.h"
-#include "netlist/macro/nlm_opamp.h"
-#include "netlist/macro/nlm_other.h"
-#include "netlist/macro/nlm_ttl74xx.h"
-
-#include "netlist/analog/nld_bjt.h"
-#include "netlist/analog/nld_fourterm.h"
-#include "netlist/analog/nld_mosfet.h"
-#include "netlist/analog/nld_opamps.h"
-#include "netlist/analog/nld_switches.h"
-#include "netlist/analog/nld_twoterm.h"
+#include "../macro/nlm_cd4xxx.h"
+#include "../macro/nlm_ttl74xx.h"
+#include "../macro/nlm_opamp.h"
+#include "../macro/nlm_other.h"
+
+#include "../analog/nld_bjt.h"
+#include "../analog/nld_fourterm.h"
+#include "../analog/nld_switches.h"
+#include "../analog/nld_twoterm.h"
+#include "../analog/nld_opamps.h"
#include "nld_legacy.h"
#endif
diff --git a/src/lib/netlist/devices/nld_2102A.cpp b/src/lib/netlist/devices/nld_2102A.cpp
index 0ec7132b401..5296bf2d029 100644
--- a/src/lib/netlist/devices/nld_2102A.cpp
+++ b/src/lib/netlist/devices/nld_2102A.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_2102A.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
#define ADDR2BYTE(a) ((a) >> 3)
#define ADDR2BIT(a) ((a) & 0x7)
@@ -39,7 +39,7 @@ namespace netlist
logic_output_t m_DO;
- state_array<uint8_t, 128> m_ram; // 1024x1 bits
+ state_var<uint8_t[128]> m_ram; // 1024x1 bits
param_ptr_t m_RAM;
};
@@ -97,8 +97,8 @@ namespace netlist
m_ram[i] = 0;
}
- NETLIB_DEVICE_IMPL(2102A, "RAM_2102A", "+CEQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+RWQ,+DI")
- NETLIB_DEVICE_IMPL(2102A_dip,"RAM_2102A_DIP","")
+ NETLIB_DEVICE_IMPL(2102A)
+ NETLIB_DEVICE_IMPL(2102A_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_2102A.h b/src/lib/netlist/devices/nld_2102A.h
index aa53efde47d..52d892d4d40 100644
--- a/src/lib/netlist/devices/nld_2102A.h
+++ b/src/lib/netlist/devices/nld_2102A.h
@@ -24,7 +24,7 @@
#ifndef NLD_2102A_H_
#define NLD_2102A_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define RAM_2102A(name, cCEQ, cA0, cA1, cA2, cA3, cA4, cA5, cA6, cA7, cA8, cA9, cRWQ, cDI) \
NET_REGISTER_DEV(RAM_2102A, name) \
diff --git a/src/lib/netlist/devices/nld_2716.cpp b/src/lib/netlist/devices/nld_2716.cpp
index b021bc95003..cb53d60e205 100644
--- a/src/lib/netlist/devices/nld_2716.cpp
+++ b/src/lib/netlist/devices/nld_2716.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_2716.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -92,8 +92,8 @@ namespace netlist
m_D[i].push((d >> i) & 1, delay);
}
- NETLIB_DEVICE_IMPL(2716, "EPROM_2716", "+GQ,+EPQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10")
- NETLIB_DEVICE_IMPL(2716_dip, "EPROM_2716_DIP", "")
+ NETLIB_DEVICE_IMPL(2716)
+ NETLIB_DEVICE_IMPL(2716_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_2716.h b/src/lib/netlist/devices/nld_2716.h
index 363086d6a37..f4776242e6a 100644
--- a/src/lib/netlist/devices/nld_2716.h
+++ b/src/lib/netlist/devices/nld_2716.h
@@ -28,7 +28,7 @@
#ifndef NLD_2716_H_
#define NLD_2716_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define EPROM_2716(name, cGQ, cEPQ, cA0, cA1, cA2, cA3, cA4, cA5, cA6, cA7, cA8, cA9, cA10) \
NET_REGISTER_DEV(EPROM_2716, name) \
diff --git a/src/lib/netlist/devices/nld_4020.cpp b/src/lib/netlist/devices/nld_4020.cpp
index 13518f9d3cb..8403d42bef2 100644
--- a/src/lib/netlist/devices/nld_4020.cpp
+++ b/src/lib/netlist/devices/nld_4020.cpp
@@ -96,9 +96,9 @@ namespace netlist
m_sub.m_IP.activate_hl();
}
- NETLIB_FUNC_VOID(CD4020_sub, update_outputs, (const unsigned cnt))
+ inline NETLIB_FUNC_VOID(CD4020_sub, update_outputs, (const unsigned cnt))
{
- static constexpr const std::array<netlist_time, 14> out_delayQn = {
+ /* static */ const netlist_time out_delayQn[14] = {
NLTIME_FROM_NS(180), NLTIME_FROM_NS(280),
NLTIME_FROM_NS(380), NLTIME_FROM_NS(480),
NLTIME_FROM_NS(580), NLTIME_FROM_NS(680),
@@ -113,8 +113,7 @@ namespace netlist
m_Q[i].push((cnt >> i) & 1, out_delayQn[i]);
}
- NETLIB_DEVICE_IMPL(CD4020, "CD4020", "")
- NETLIB_DEVICE_IMPL_ALIAS(CD4020_WI, CD4020, "CD4020_WI", "+IP,+RESET,+VDD,+VSS")
+ NETLIB_DEVICE_IMPL(CD4020)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_4020.h b/src/lib/netlist/devices/nld_4020.h
index f24251fb1dc..fd6b234da46 100644
--- a/src/lib/netlist/devices/nld_4020.h
+++ b/src/lib/netlist/devices/nld_4020.h
@@ -27,7 +27,7 @@
#ifndef NLD_4020_H_
#define NLD_4020_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
/* FIXME: only used in mario.c */
#define CD4020_WI(name, cIP, cRESET, cVDD, cVSS) \
diff --git a/src/lib/netlist/devices/nld_4066.cpp b/src/lib/netlist/devices/nld_4066.cpp
index 0c7511ca438..ebd269a023a 100644
--- a/src/lib/netlist/devices/nld_4066.cpp
+++ b/src/lib/netlist/devices/nld_4066.cpp
@@ -5,11 +5,9 @@
*
*/
-#include "nld_4066.h"
-
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/solver/nld_solver.h"
#include "nlid_cmos.h"
+#include "../analog/nlid_twoterm.h"
+#include "nld_4066.h"
namespace netlist
{
@@ -29,7 +27,7 @@ namespace netlist
NETLIB_RESETI();
NETLIB_UPDATEI();
- private:
+ public:
NETLIB_SUB(vdd_vss) m_supply;
analog::NETLIB_SUB(R_base) m_R;
@@ -41,36 +39,45 @@ namespace netlist
{
// Start in off condition
// FIXME: is ROFF correct?
- m_R.set_R(plib::constants<nl_double>::one() / exec().gmin());
+ m_R.set_R(NL_FCONST(1.0) / netlist().gmin());
}
NETLIB_UPDATE(CD4066_GATE)
{
nl_double sup = (m_supply.vdd() - m_supply.vss());
- nl_double low = plib::constants<nl_double>::cast(0.45) * sup;
- nl_double high = plib::constants<nl_double>::cast(0.55) * sup;
+ nl_double low = NL_FCONST(0.45) * sup;
+ nl_double high = NL_FCONST(0.55) * sup;
nl_double in = m_control() - m_supply.vss();
- nl_double rON = m_base_r() * plib::constants<nl_double>::cast(5.0) / sup;
+ nl_double rON = m_base_r() * NL_FCONST(5.0) / sup;
nl_double R = -1.0;
if (in < low)
{
- R = plib::constants<nl_double>::one() / exec().gmin();
+ R = NL_FCONST(1.0) / netlist().gmin();
}
else if (in > high)
{
R = rON;
}
- if (R > plib::constants<nl_double>::zero())
+ if (R > NL_FCONST(0.0))
{
- m_R.update();
- m_R.set_R(R);
- m_R.solve_later();
+ // We only need to update the net first if this is a time stepping net
+ if ((1)) // m_R.m_P.net().as_analog().solver().is_timestep())
+ {
+ m_R.update_dev();
+ m_R.set_R(R);
+ m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
+ }
+ else
+ {
+ m_R.set_R(R);
+ m_R.update_dev();
+ }
}
}
- NETLIB_DEVICE_IMPL(CD4066_GATE, "CD4066_GATE", "")
+ NETLIB_DEVICE_IMPL(CD4066_GATE)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_4066.h b/src/lib/netlist/devices/nld_4066.h
index d339464a108..e9fd579496c 100644
--- a/src/lib/netlist/devices/nld_4066.h
+++ b/src/lib/netlist/devices/nld_4066.h
@@ -24,7 +24,7 @@
#ifndef NLD_4066_H_
#define NLD_4066_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define CD4066_GATE(name) \
NET_REGISTER_DEV(CD4066_GATE, name)
diff --git a/src/lib/netlist/devices/nld_4316.cpp b/src/lib/netlist/devices/nld_4316.cpp
index c8ee1a90643..b9758ff036b 100644
--- a/src/lib/netlist/devices/nld_4316.cpp
+++ b/src/lib/netlist/devices/nld_4316.cpp
@@ -5,10 +5,9 @@
*
*/
-#include "nld_4316.h"
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/solver/nld_solver.h"
#include "nlid_cmos.h"
+#include "../analog/nlid_twoterm.h"
+#include "nld_4316.h"
namespace netlist { namespace devices {
@@ -38,20 +37,19 @@ namespace netlist { namespace devices {
NETLIB_RESET(CD4316_GATE)
{
- m_R.set_R(plib::constants<nl_double>::one() / exec().gmin());
+ m_R.set_R(NL_FCONST(1.0) / netlist().gmin());
}
NETLIB_UPDATE(CD4316_GATE)
{
- m_R.update();
+ m_R.update_dev();
if (m_S() && !m_E())
m_R.set_R(m_base_r());
else
- m_R.set_R(plib::constants<nl_double>::one() / exec().gmin());
- m_R.solve_later(NLTIME_FROM_NS(1));
+ m_R.set_R(NL_FCONST(1.0) / netlist().gmin());
+ m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
}
- NETLIB_DEVICE_IMPL(CD4316_GATE, "CD4316_GATE", "")
+ NETLIB_DEVICE_IMPL(CD4316_GATE)
-} // namespace devices
- } // namespace netlist
+} } // namesapce netlist::devices
diff --git a/src/lib/netlist/devices/nld_4316.h b/src/lib/netlist/devices/nld_4316.h
index 278a2793a6f..eb1d13f5542 100644
--- a/src/lib/netlist/devices/nld_4316.h
+++ b/src/lib/netlist/devices/nld_4316.h
@@ -25,7 +25,7 @@
#ifndef NLD_4316_H_
#define NLD_4316_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define CD4316_GATE(name) \
NET_REGISTER_DEV(CD4316_GATE, name)
diff --git a/src/lib/netlist/devices/nld_74107.cpp b/src/lib/netlist/devices/nld_74107.cpp
index 763760e2c6a..c5a12a15fb4 100644
--- a/src/lib/netlist/devices/nld_74107.cpp
+++ b/src/lib/netlist/devices/nld_74107.cpp
@@ -6,15 +6,15 @@
*/
#include "nld_74107.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
namespace devices
{
- static constexpr const netlist_time delay_107[2] = { NLTIME_FROM_NS(16), NLTIME_FROM_NS(25) };
- static constexpr const netlist_time delay_107A[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(15) };
+ static constexpr netlist_time delay_107[2] = { NLTIME_FROM_NS(16), NLTIME_FROM_NS(25) };
+ static constexpr netlist_time delay_107A[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(15) };
NETLIB_OBJECT(74107A)
{
@@ -22,12 +22,11 @@ namespace netlist
, m_clk(*this, "CLK", NETLIB_DELEGATE(74107A, clk))
, m_Q(*this, "Q")
, m_QQ(*this, "QQ")
+ , m_delay(delay_107A)
, m_J(*this, "J")
, m_K(*this, "K")
, m_clrQ(*this, "CLRQ")
{
- m_delay[0] = delay_107A[0];
- m_delay[1] = delay_107A[1];
}
friend class NETLIB_NAME(74107_dip);
@@ -44,7 +43,7 @@ namespace netlist
logic_output_t m_Q;
logic_output_t m_QQ;
- netlist_time m_delay[2];
+ const netlist_time *m_delay;
logic_input_t m_J;
logic_input_t m_K;
@@ -62,8 +61,7 @@ namespace netlist
public:
NETLIB_CONSTRUCTOR_DERIVED(74107, 74107A)
{
- m_delay[0] = delay_107[0];
- m_delay[1] = delay_107[1];
+ m_delay = delay_107;
}
};
@@ -139,9 +137,9 @@ namespace netlist
m_clk.activate_hl();
}
- NETLIB_DEVICE_IMPL(74107, "TTL_74107", "+CLK,+J,+K,+CLRQ")
- NETLIB_DEVICE_IMPL(74107A, "TTL_74107A", "+CLK,+J,+K,+CLRQ")
- NETLIB_DEVICE_IMPL(74107_dip, "TTL_74107_DIP", "")
+ NETLIB_DEVICE_IMPL(74107)
+ NETLIB_DEVICE_IMPL(74107A)
+ NETLIB_DEVICE_IMPL(74107_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74107.h b/src/lib/netlist/devices/nld_74107.h
index c6f8864610a..b59848cbb05 100644
--- a/src/lib/netlist/devices/nld_74107.h
+++ b/src/lib/netlist/devices/nld_74107.h
@@ -64,7 +64,7 @@
#ifndef NLD_74107_H_
#define NLD_74107_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74107A(name, cCLK, cJ, cK, cCLRQ) \
NET_REGISTER_DEV(TTL_74107A, name) \
diff --git a/src/lib/netlist/devices/nld_74123.cpp b/src/lib/netlist/devices/nld_74123.cpp
index 32e47a47ef2..9055c5ce140 100644
--- a/src/lib/netlist/devices/nld_74123.cpp
+++ b/src/lib/netlist/devices/nld_74123.cpp
@@ -6,7 +6,7 @@
*/
#include "nlid_system.h"
-#include "netlist/analog/nlid_twoterm.h"
+#include "../analog/nlid_twoterm.h"
#include <cmath>
@@ -257,8 +257,8 @@ namespace netlist
{
m_KP = 1.0 / (1.0 + exp(m_K()));
- m_RP.reset();
- m_RN.reset();
+ m_RP.do_reset();
+ m_RN.do_reset();
//m_RP.set_R(R_OFF);
//m_RN.set_R(R_OFF);
@@ -276,8 +276,8 @@ namespace netlist
NETLIB_RESET(74123_dip)
{
- //m_1.reset();
- //m_2.reset();
+ //m_1.do_reset();
+ //m_2.do_reset();
}
NETLIB_UPDATE(9602_dip)
@@ -289,8 +289,8 @@ namespace netlist
NETLIB_RESET(9602_dip)
{
- //m_1.reset();
- //m_2.reset();
+ //m_1.do_reset();
+ //m_2.do_reset();
}
NETLIB_UPDATE(4538_dip)
@@ -302,14 +302,14 @@ namespace netlist
NETLIB_RESET(4538_dip)
{
- m_1.reset();
- m_2.reset();
+ m_1.do_reset();
+ m_2.do_reset();
}
- NETLIB_DEVICE_IMPL(74123, "TTL_74123", "")
- NETLIB_DEVICE_IMPL(74123_dip, "TTL_74123_DIP", "")
- NETLIB_DEVICE_IMPL(4538_dip, "CD4538_DIP", "")
- NETLIB_DEVICE_IMPL(9602_dip, "TTL_9602_DIP", "")
+ NETLIB_DEVICE_IMPL(74123)
+ NETLIB_DEVICE_IMPL(74123_dip)
+ NETLIB_DEVICE_IMPL(4538_dip)
+ NETLIB_DEVICE_IMPL(9602_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74123.h b/src/lib/netlist/devices/nld_74123.h
index 3eca141b613..dfd75f746c7 100644
--- a/src/lib/netlist/devices/nld_74123.h
+++ b/src/lib/netlist/devices/nld_74123.h
@@ -49,7 +49,7 @@
#ifndef NLD_74123_H_
#define NLD_74123_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74123(name) \
NET_REGISTER_DEV(TTL_74123, name)
diff --git a/src/lib/netlist/devices/nld_74153.cpp b/src/lib/netlist/devices/nld_74153.cpp
index 136fe61520b..b74c09f8cc0 100644
--- a/src/lib/netlist/devices/nld_74153.cpp
+++ b/src/lib/netlist/devices/nld_74153.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74153.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -120,19 +120,19 @@ namespace netlist
NETLIB_UPDATE(74153)
{
m_sub.m_chan = (m_A() | (m_B()<<1));
- m_sub.update();
+ m_sub.update_dev();
}
NETLIB_UPDATE(74153_dip)
{
m_2.m_chan = m_1.m_chan = (m_A() | (m_B()<<1));
- m_1.update();
- m_2.update();
+ m_1.update_dev();
+ m_2.update_dev();
}
- NETLIB_DEVICE_IMPL(74153, "TTL_74153", "+C0,+C1,+C2,+C3,+A,+B,+G")
- NETLIB_DEVICE_IMPL(74153_dip, "TTL_74153_DIP", "")
+ NETLIB_DEVICE_IMPL(74153)
+ NETLIB_DEVICE_IMPL(74153_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74153.h b/src/lib/netlist/devices/nld_74153.h
index f1c0f056cf7..ee77d4224ce 100644
--- a/src/lib/netlist/devices/nld_74153.h
+++ b/src/lib/netlist/devices/nld_74153.h
@@ -45,7 +45,7 @@
#ifndef NLD_74153_H_
#define NLD_74153_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74153(name, cC0, cC1, cC2, cC3, cA, cB, cG) \
NET_REGISTER_DEV(TTL_74153, name) \
diff --git a/src/lib/netlist/devices/nld_74161.cpp b/src/lib/netlist/devices/nld_74161.cpp
index 7a3b54d6368..5eb711fb456 100644
--- a/src/lib/netlist/devices/nld_74161.cpp
+++ b/src/lib/netlist/devices/nld_74161.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74161.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -85,7 +85,7 @@ namespace netlist
}
// FIXME: Timing
- static constexpr const netlist_time delay[4] =
+ static constexpr netlist_time delay[4] =
{
NLTIME_FROM_NS(40),
NLTIME_FROM_NS(40),
@@ -126,8 +126,8 @@ namespace netlist
m_RCO.push(tRippleCarryOut, NLTIME_FROM_NS(20)); //FIXME
}
- NETLIB_DEVICE_IMPL(74161, "TTL_74161", "+A,+B,+C,+D,+CLRQ,+LOADQ,+CLK,+ENABLEP,+ENABLET")
- NETLIB_DEVICE_IMPL(74161_dip, "TTL_74161_DIP", "")
+ NETLIB_DEVICE_IMPL(74161)
+ NETLIB_DEVICE_IMPL(74161_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74161.h b/src/lib/netlist/devices/nld_74161.h
index f3fa3eab043..363bc3c7f0d 100644
--- a/src/lib/netlist/devices/nld_74161.h
+++ b/src/lib/netlist/devices/nld_74161.h
@@ -25,7 +25,7 @@
#ifndef NLD_74161_H_
#define NLD_74161_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74161(name, cA, cB, cC, cD, cCLRQ, cLOADQ, cCLK, cENABLEP, cENABLET) \
NET_REGISTER_DEV(TTL_74161, name) \
diff --git a/src/lib/netlist/devices/nld_74164.cpp b/src/lib/netlist/devices/nld_74164.cpp
index b1eb30bb1ba..5b2b1d8d080 100644
--- a/src/lib/netlist/devices/nld_74164.cpp
+++ b/src/lib/netlist/devices/nld_74164.cpp
@@ -9,7 +9,7 @@
*/
#include "nld_74164.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -97,8 +97,8 @@ namespace netlist
}
}
- NETLIB_DEVICE_IMPL(74164, "TTL_74164", "+A,+B,+CLRQ,+CLK")
- NETLIB_DEVICE_IMPL(74164_dip, "TTL_74164_DIP", "")
+ NETLIB_DEVICE_IMPL(74164)
+ NETLIB_DEVICE_IMPL(74164_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74164.h b/src/lib/netlist/devices/nld_74164.h
index dd4e6bd1303..d7f29d386de 100644
--- a/src/lib/netlist/devices/nld_74164.h
+++ b/src/lib/netlist/devices/nld_74164.h
@@ -42,7 +42,7 @@
#ifndef NLD_74164_H_
#define NLD_74164_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74164(name, cA, cB, cCLRQ, cCLK) \
NET_REGISTER_DEV(TTL_74164, name) \
diff --git a/src/lib/netlist/devices/nld_74165.cpp b/src/lib/netlist/devices/nld_74165.cpp
index 521bf4d63d2..678c1b1782e 100644
--- a/src/lib/netlist/devices/nld_74165.cpp
+++ b/src/lib/netlist/devices/nld_74165.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74165.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -86,7 +86,6 @@ namespace netlist
}
else if (!m_CLK() || m_CLKINH())
{
- // FIXME: qh is overwritten below?
qh = old_qh;
}
else if (!m_last_CLK)
@@ -102,8 +101,8 @@ namespace netlist
m_QH.push(qh, NLTIME_FROM_NS(20)); // FIXME: Timing
}
- NETLIB_DEVICE_IMPL(74165, "TTL_74165", "+CLK,+CLKINH,+SH_LDQ,+SER,+A,+B,+C,+D,+E,+F,+G,+H")
- NETLIB_DEVICE_IMPL(74165_dip, "TTL_74165_DIP", "")
+ NETLIB_DEVICE_IMPL(74165)
+ NETLIB_DEVICE_IMPL(74165_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74165.h b/src/lib/netlist/devices/nld_74165.h
index d282bab622b..e38ca7bab86 100644
--- a/src/lib/netlist/devices/nld_74165.h
+++ b/src/lib/netlist/devices/nld_74165.h
@@ -27,7 +27,7 @@
#ifndef NLD_74165_H_
#define NLD_74165_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74165(name, cCLK, cCLKINH, cSH_LDQ, cSER, cA, cB, cC, cD, cE, cF, cG, cH) \
NET_REGISTER_DEV(TTL_74165, name) \
diff --git a/src/lib/netlist/devices/nld_74166.cpp b/src/lib/netlist/devices/nld_74166.cpp
index a5049014576..32f075c4da5 100644
--- a/src/lib/netlist/devices/nld_74166.cpp
+++ b/src/lib/netlist/devices/nld_74166.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74166.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -121,8 +121,8 @@ namespace netlist
m_QH.push(qh, delay); //FIXME
}
- NETLIB_DEVICE_IMPL(74166, "TTL_74166", "+CLK,+CLKINH,+SH_LDQ,+SER,+A,+B,+C,+D,+E,+F,+G,+H,+CLRQ")
- NETLIB_DEVICE_IMPL(74166_dip,"TTL_74166_DIP", "")
+ NETLIB_DEVICE_IMPL(74166)
+ NETLIB_DEVICE_IMPL(74166_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74166.h b/src/lib/netlist/devices/nld_74166.h
index 80c86bb3422..b8a8a204374 100644
--- a/src/lib/netlist/devices/nld_74166.h
+++ b/src/lib/netlist/devices/nld_74166.h
@@ -27,7 +27,7 @@
#ifndef NLD_74166_H_
#define NLD_74166_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74166(name, cCLK, cCLKINH, cSH_LDQ, cSER, cA, cB, cC, cD, cE, cF, cG, cH, cCLRQ) \
NET_REGISTER_DEV(TTL_74166, name) \
diff --git a/src/lib/netlist/devices/nld_74174.cpp b/src/lib/netlist/devices/nld_74174.cpp
index 83369075db6..5f4573942bd 100644
--- a/src/lib/netlist/devices/nld_74174.cpp
+++ b/src/lib/netlist/devices/nld_74174.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74174.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -134,8 +134,8 @@ namespace netlist
//m_sub.do_reset();
}
- NETLIB_DEVICE_IMPL(74174, "TTL_74174", "+CLK,+D1,+D2,+D3,+D4,+D5,+D6,+CLRQ")
- NETLIB_DEVICE_IMPL(74174_dip,"TTL_74174_DIP", "")
+ NETLIB_DEVICE_IMPL(74174)
+ NETLIB_DEVICE_IMPL(74174_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74174.h b/src/lib/netlist/devices/nld_74174.h
index f1854801291..66824abb7aa 100644
--- a/src/lib/netlist/devices/nld_74174.h
+++ b/src/lib/netlist/devices/nld_74174.h
@@ -36,7 +36,7 @@
#ifndef NLD_74174_H_
#define NLD_74174_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74174(name, cCLK, cD1, cD2, cD3, cD4, cD5, cD6, cCLRQ) \
NET_REGISTER_DEV(TTL_74174, name) \
diff --git a/src/lib/netlist/devices/nld_74175.cpp b/src/lib/netlist/devices/nld_74175.cpp
index a15adb5c60f..5955bcb389e 100644
--- a/src/lib/netlist/devices/nld_74175.cpp
+++ b/src/lib/netlist/devices/nld_74175.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74175.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -111,8 +111,8 @@ namespace netlist
m_data = 0xFF;
}
- NETLIB_DEVICE_IMPL(74175, "TTL_74175", "+CLK,+D1,+D2,+D3,+D4,+CLRQ")
- NETLIB_DEVICE_IMPL(74175_dip,"TTL_74175_DIP", "")
+ NETLIB_DEVICE_IMPL(74175)
+ NETLIB_DEVICE_IMPL(74175_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74175.h b/src/lib/netlist/devices/nld_74175.h
index 4bc8c1175ba..27e01b55b05 100644
--- a/src/lib/netlist/devices/nld_74175.h
+++ b/src/lib/netlist/devices/nld_74175.h
@@ -36,7 +36,7 @@
#ifndef NLD_74175_H_
#define NLD_74175_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74175(name, cCLK, cD1, cD2, cD3, cD4, cCLRQ) \
NET_REGISTER_DEV(TTL_74175, name) \
diff --git a/src/lib/netlist/devices/nld_74192.cpp b/src/lib/netlist/devices/nld_74192.cpp
index 954fc351179..1af605d4776 100644
--- a/src/lib/netlist/devices/nld_74192.cpp
+++ b/src/lib/netlist/devices/nld_74192.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74192.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -110,7 +110,7 @@ namespace netlist
}
// FIXME: Timing
- static constexpr const netlist_time delay[4] =
+ static constexpr netlist_time delay[4] =
{
NLTIME_FROM_NS(40),
NLTIME_FROM_NS(40),
@@ -162,8 +162,8 @@ namespace netlist
m_CARRYQ.push(tCarry, NLTIME_FROM_NS(20)); //FIXME
}
- NETLIB_DEVICE_IMPL(74192, "TTL_74192", "+A,+B,+C,+D,+CLEAR,+LOADQ,+CU,+CD")
- NETLIB_DEVICE_IMPL(74192_dip,"TTL_74192_DIP", "")
+ NETLIB_DEVICE_IMPL(74192)
+ NETLIB_DEVICE_IMPL(74192_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74192.h b/src/lib/netlist/devices/nld_74192.h
index 9b0139070b8..613d463cf47 100644
--- a/src/lib/netlist/devices/nld_74192.h
+++ b/src/lib/netlist/devices/nld_74192.h
@@ -29,7 +29,7 @@
#ifndef NLD_74192_H_
#define NLD_74192_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74192(name, cA, cB, cC, cD, cCLEAR, cLOADQ, cCU, cCD) \
NET_REGISTER_DEV(TTL_74192, name) \
diff --git a/src/lib/netlist/devices/nld_74193.cpp b/src/lib/netlist/devices/nld_74193.cpp
index 16d7438d799..55d18f3dc1b 100644
--- a/src/lib/netlist/devices/nld_74193.cpp
+++ b/src/lib/netlist/devices/nld_74193.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74193.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -87,7 +87,7 @@ namespace netlist
}
// FIXME: Timing
- static constexpr const netlist_time delay[4] =
+ static constexpr netlist_time delay[4] =
{
NLTIME_FROM_NS(40),
NLTIME_FROM_NS(40),
@@ -139,8 +139,8 @@ namespace netlist
m_CARRYQ.push(tCarry, NLTIME_FROM_NS(20)); //FIXME timing
}
- NETLIB_DEVICE_IMPL(74193, "TTL_74193", "+A,+B,+C,+D,+CLEAR,+LOADQ,+CU,+CD")
- NETLIB_DEVICE_IMPL(74193_dip, "TTL_74193_DIP", "")
+ NETLIB_DEVICE_IMPL(74193)
+ NETLIB_DEVICE_IMPL(74193_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74193.h b/src/lib/netlist/devices/nld_74193.h
index a4c745d5386..bb14a301f38 100644
--- a/src/lib/netlist/devices/nld_74193.h
+++ b/src/lib/netlist/devices/nld_74193.h
@@ -26,7 +26,7 @@
#ifndef NLD_74193_H_
#define NLD_74193_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74193(name, cA, cB, cC, cD, cCLEAR, cLOADQ, cCU, cCD) \
NET_REGISTER_DEV(TTL_74193, name) \
diff --git a/src/lib/netlist/devices/nld_74194.cpp b/src/lib/netlist/devices/nld_74194.cpp
index 9876aa6b170..d531e792885 100644
--- a/src/lib/netlist/devices/nld_74194.cpp
+++ b/src/lib/netlist/devices/nld_74194.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_74194.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -116,8 +116,8 @@ namespace netlist
m_Q[i].push((q >> i) & 1, NLTIME_FROM_NS(26)); // FIXME: Timing
}
- NETLIB_DEVICE_IMPL(74194, "TTL_74194", "+CLK,+S0,+S1,+SRIN,+A,+B,+C,+D,+SLIN,+CLRQ")
- NETLIB_DEVICE_IMPL(74194_dip, "TTL_74194_DIP", "")
+ NETLIB_DEVICE_IMPL(74194)
+ NETLIB_DEVICE_IMPL(74194_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74194.h b/src/lib/netlist/devices/nld_74194.h
index 5a507982b81..5124a66bcc0 100644
--- a/src/lib/netlist/devices/nld_74194.h
+++ b/src/lib/netlist/devices/nld_74194.h
@@ -26,7 +26,7 @@
#ifndef NLD_74194_H_
#define NLD_74194_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74194(name, cCLK, cS0, cS1, cSRIN, cA, cB, cC, cD, cSLIN, cCLRQ) \
NET_REGISTER_DEV(TTL_74194, name) \
diff --git a/src/lib/netlist/devices/nld_74365.cpp b/src/lib/netlist/devices/nld_74365.cpp
index 753f16bfd22..10456ebbc21 100644
--- a/src/lib/netlist/devices/nld_74365.cpp
+++ b/src/lib/netlist/devices/nld_74365.cpp
@@ -6,20 +6,12 @@
*/
#include "nld_74365.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
namespace devices
{
-
- /* FIXME: This should be a single device, i.e. one tristate buffer only.
- *
- * FIXME: Implement tristate output.
- *
- */
-
-
NETLIB_OBJECT(74365)
{
NETLIB_CONSTRUCTOR(74365)
@@ -76,8 +68,8 @@ namespace netlist
}
}
- NETLIB_DEVICE_IMPL(74365, "TTL_74365", "+G1Q,+G2Q,+A1,+A2,+A3,+A4,+A5,+A6")
- NETLIB_DEVICE_IMPL(74365_dip, "TTL_74365_DIP", "")
+ NETLIB_DEVICE_IMPL(74365)
+ NETLIB_DEVICE_IMPL(74365_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74365.h b/src/lib/netlist/devices/nld_74365.h
index a50b535383f..ca0eacf6ba1 100644
--- a/src/lib/netlist/devices/nld_74365.h
+++ b/src/lib/netlist/devices/nld_74365.h
@@ -25,7 +25,7 @@
#ifndef NLD_74365_H_
#define NLD_74365_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_74365(name, cG1Q, cG2Q, cA1, cA2, cA3, cA4, cA5, cA6) \
NET_REGISTER_DEV(TTL_74365, name) \
diff --git a/src/lib/netlist/devices/nld_7448.cpp b/src/lib/netlist/devices/nld_7448.cpp
index 4500229a1c5..cc2e60f23b7 100644
--- a/src/lib/netlist/devices/nld_7448.cpp
+++ b/src/lib/netlist/devices/nld_7448.cpp
@@ -5,10 +5,8 @@
*
*/
+#include "nlid_truthtable.h"
#include "nld_7448.h"
-#include "nlid_truthtable.h"
-
-#include <array>
namespace netlist
{
@@ -135,9 +133,9 @@ namespace netlist
#else
-#define BITS7(b6,b5,b4,b3,b2,b1,b0) ((b6)<<6) | ((b5)<<5) | ((b4)<<4) | ((b3)<<3) | ((b2)<<2) | ((b1)<<1) | ((b0)<<0)
+#define BITS7(b6,b5,b4,b3,b2,b1,b0) (b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | (b0<<0)
- static constexpr const std::array<uint8_t, 16> tab7448 =
+ static constexpr uint8_t tab7448[16] =
{
BITS7( 1, 1, 1, 1, 1, 1, 0 ), /* 00 - not blanked ! */
BITS7( 0, 1, 1, 0, 0, 0, 0 ), /* 01 */
@@ -190,13 +188,11 @@ namespace netlist
NETLIB_RESET(7448)
{
m_state = 0;
-#if 0
- m_A.set_state(logic_t::STATE_INP_PASSIVE);
- m_B.set_state(logic_t::STATE_INP_PASSIVE);
- m_C.set_state(logic_t::STATE_INP_PASSIVE);
- m_D.set_state(logic_t::STATE_INP_PASSIVE);
- m_RBIQ.set_state(logic_t::STATE_INP_PASSIVE);
-#endif
+ m_A.inactivate();
+ m_B.inactivate();
+ m_C.inactivate();
+ m_D.inactivate();
+ m_RBIQ.inactivate();
}
NETLIB_FUNC_VOID(7448, update_outputs, (unsigned v))
@@ -215,8 +211,8 @@ namespace netlist
#endif
- NETLIB_DEVICE_IMPL(7448, "TTL_7448", "+A,+B,+C,+D,+LTQ,+BIQ,+RBIQ")
- NETLIB_DEVICE_IMPL(7448_dip, "TTL_7448_DIP", "")
+ NETLIB_DEVICE_IMPL(7448)
+ NETLIB_DEVICE_IMPL(7448_dip)
} //namespace devices
diff --git a/src/lib/netlist/devices/nld_7448.h b/src/lib/netlist/devices/nld_7448.h
index b9c03ae6360..89528707bc1 100644
--- a/src/lib/netlist/devices/nld_7448.h
+++ b/src/lib/netlist/devices/nld_7448.h
@@ -24,7 +24,7 @@
#ifndef NLD_7448_H_
#define NLD_7448_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#ifndef NL_AUTO_DEVICES
diff --git a/src/lib/netlist/devices/nld_7450.cpp b/src/lib/netlist/devices/nld_7450.cpp
index aacab46a021..af9b9afada1 100644
--- a/src/lib/netlist/devices/nld_7450.cpp
+++ b/src/lib/netlist/devices/nld_7450.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_7450.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -68,10 +68,10 @@ namespace netlist
m_B.activate();
m_C.activate();
m_D.activate();
- auto t1 = m_A() & m_B();
- auto t2 = m_C() & m_D();
+ unsigned t1 = m_A() & m_B();
+ unsigned t2 = m_C() & m_D();
- const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
+ const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) };
uint_fast8_t res = 0;
if (t1 ^ 1)
@@ -85,20 +85,18 @@ namespace netlist
m_A.inactivate();
m_B.inactivate();
}
- }
- else
- {
+ } else {
if (t2 ^ 1)
{
m_C.inactivate();
m_D.inactivate();
}
}
- m_Q.push(res, times[res]);// ? 22000 : 15000);
+ m_Q.push(res, times[1 - res]);// ? 22000 : 15000);
}
- NETLIB_DEVICE_IMPL(7450, "TTL_7450_ANDORINVERT", "+A,+B,+C,+D")
- NETLIB_DEVICE_IMPL(7450_dip, "TTL_7450_DIP", "")
+ NETLIB_DEVICE_IMPL(7450)
+ NETLIB_DEVICE_IMPL(7450_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7450.h b/src/lib/netlist/devices/nld_7450.h
index 6718afd8f9e..652516758ad 100644
--- a/src/lib/netlist/devices/nld_7450.h
+++ b/src/lib/netlist/devices/nld_7450.h
@@ -24,7 +24,7 @@
#ifndef NLD_7450_H_
#define NLD_7450_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_7450_ANDORINVERT(name, cI1, cI2, cI3, cI4) \
NET_REGISTER_DEV(TTL_7450_ANDORINVERT, name) \
diff --git a/src/lib/netlist/devices/nld_7473.cpp b/src/lib/netlist/devices/nld_7473.cpp
index c8abd829264..d9efb9fb710 100644
--- a/src/lib/netlist/devices/nld_7473.cpp
+++ b/src/lib/netlist/devices/nld_7473.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_7473.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -142,10 +142,10 @@ namespace netlist
m_QQ.push(m_q ^ 1, NLTIME_FROM_NS(20)); // FIXME: timing
}
- NETLIB_DEVICE_IMPL(7473, "TTL_7473", "+CLK,+J,+K,+CLRQ")
- NETLIB_DEVICE_IMPL(7473A, "TTL_7473A", "+CLK,+J,+K,+CLRQ")
- NETLIB_DEVICE_IMPL(7473_dip, "TTL_7473_DIP", "")
- NETLIB_DEVICE_IMPL(7473A_dip, "TTL_7473A_DIP", "")
+ NETLIB_DEVICE_IMPL(7473)
+ NETLIB_DEVICE_IMPL(7473A)
+ NETLIB_DEVICE_IMPL(7473_dip)
+ NETLIB_DEVICE_IMPL(7473A_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7473.h b/src/lib/netlist/devices/nld_7473.h
index 3fbaaf4efbc..5313d18570c 100644
--- a/src/lib/netlist/devices/nld_7473.h
+++ b/src/lib/netlist/devices/nld_7473.h
@@ -60,7 +60,7 @@
#ifndef NLD_7473_H_
#define NLD_7473_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_7473(name, cCLK, cJ, cK, cCLRQ) \
NET_REGISTER_DEV(TTL_7473, name) \
diff --git a/src/lib/netlist/devices/nld_7474.cpp b/src/lib/netlist/devices/nld_7474.cpp
index 740af6ad3c1..9d020663f46 100644
--- a/src/lib/netlist/devices/nld_7474.cpp
+++ b/src/lib/netlist/devices/nld_7474.cpp
@@ -1,4 +1,3 @@
-
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
@@ -7,47 +6,60 @@
*/
#include "nld_7474.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
namespace devices
{
-
- NETLIB_OBJECT(7474)
+ NETLIB_OBJECT(7474sub)
{
- NETLIB_CONSTRUCTOR(7474)
- , m_D(*this, "D")
- , m_CLRQ(*this, "CLRQ")
- , m_PREQ(*this, "PREQ")
- , m_CLK(*this, "CLK", NETLIB_DELEGATE(7474, clk))
+ NETLIB_CONSTRUCTOR(7474sub)
+ , m_CLK(*this, "CLK")
, m_Q(*this, "Q")
, m_QQ(*this, "QQ")
, m_nextD(*this, "m_nextD", 0)
{
}
- private:
NETLIB_RESETI();
NETLIB_UPDATEI();
- NETLIB_HANDLERI(clk);
- logic_input_t m_D;
- logic_input_t m_CLRQ;
- logic_input_t m_PREQ;
+ public:
logic_input_t m_CLK;
logic_output_t m_Q;
logic_output_t m_QQ;
+ state_var<unsigned> m_nextD;
+
+ inline void newstate(const netlist_sig_t stateQ, const netlist_sig_t stateQQ);
- state_var<netlist_sig_t> m_nextD;
+ private:
+
+ };
- void newstate(const netlist_sig_t stateQ, const netlist_sig_t stateQQ)
+ NETLIB_OBJECT(7474)
+ {
+ NETLIB_CONSTRUCTOR(7474)
+ , sub(*this, "sub")
+ , m_D(*this, "D")
+ , m_CLRQ(*this, "CLRQ")
+ , m_PREQ(*this, "PREQ")
{
- // 0: High-to-low 40 ns, 1: Low-to-high 25 ns
- static constexpr const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
- m_Q.push(stateQ, delay[stateQ]);
- m_QQ.push(stateQQ, delay[stateQQ]);
+ register_subalias("CLK", sub.m_CLK);
+
+ register_subalias("Q", sub.m_Q);
+ register_subalias("QQ", sub.m_QQ);
}
+
+ NETLIB_RESETI();
+ NETLIB_UPDATEI();
+
+ public:
+ NETLIB_SUB(7474sub) sub;
+
+ logic_input_t m_D;
+ logic_input_t m_CLRQ;
+ logic_input_t m_PREQ;
};
NETLIB_OBJECT(7474_dip)
@@ -56,20 +68,20 @@ namespace netlist
, m_1(*this, "1")
, m_2(*this, "2")
{
- register_subalias("1", "1.CLRQ");
- register_subalias("2", "1.D");
- register_subalias("3", "1.CLK");
- register_subalias("4", "1.PREQ");
- register_subalias("5", "1.Q");
- register_subalias("6", "1.QQ");
+ register_subalias("1", m_1.m_CLRQ);
+ register_subalias("2", m_1.m_D);
+ register_subalias("3", m_1.sub.m_CLK);
+ register_subalias("4", m_1.m_PREQ);
+ register_subalias("5", m_1.sub.m_Q);
+ register_subalias("6", m_1.sub.m_QQ);
// register_subalias("7", ); ==> GND
- register_subalias("8", "2.QQ");
- register_subalias("9", "2.Q");
- register_subalias("10", "2.PREQ");
- register_subalias("11", "2.CLK");
- register_subalias("12", "2.D");
- register_subalias("13", "2.CLRQ");
+ register_subalias("8", m_2.sub.m_QQ);
+ register_subalias("9", m_2.sub.m_Q);
+ register_subalias("10", m_2.m_PREQ);
+ register_subalias("11", m_2.sub.m_CLK);
+ register_subalias("12", m_2.m_D);
+ register_subalias("13", m_2.m_CLRQ);
// register_subalias("14", ); ==> VCC
}
NETLIB_UPDATEI();
@@ -80,47 +92,77 @@ namespace netlist
NETLIB_SUB(7474) m_2;
};
- NETLIB_HANDLER(7474, clk)
+ inline void NETLIB_NAME(7474sub)::newstate(const netlist_sig_t stateQ, const netlist_sig_t stateQQ)
{
- newstate(m_nextD, !m_nextD);
- m_CLK.inactivate();
+ // 0: High-to-low 40 ns, 1: Low-to-high 25 ns
+ const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
+ m_Q.push(stateQ, delay[stateQ]);
+ m_QQ.push(stateQQ, delay[stateQQ]);
+ }
+
+ NETLIB_UPDATE(7474sub)
+ {
+ //if (INP_LH(m_CLK))
+ {
+ newstate(m_nextD, !m_nextD);
+ m_CLK.inactivate();
+ }
}
NETLIB_UPDATE(7474)
{
- const auto preq(m_PREQ());
- const auto clrq(m_CLRQ());
- if (preq & clrq)
+ if (m_PREQ() && m_CLRQ())
{
m_D.activate();
- m_nextD = m_D();
- m_CLK.activate_lh();
+ sub.m_nextD = m_D();
+ sub.m_CLK.activate_lh();
+ }
+ else if (!m_PREQ())
+ {
+ sub.newstate(1, 0);
+ sub.m_CLK.inactivate();
+ m_D.inactivate();
+ }
+ else if (!m_CLRQ())
+ {
+ sub.newstate(0, 1);
+ sub.m_CLK.inactivate();
+ m_D.inactivate();
}
else
{
- newstate(preq ^ 1, clrq ^ 1);
- m_CLK.inactivate();
+ sub.newstate(1, 1);
+ sub.m_CLK.inactivate();
m_D.inactivate();
}
}
NETLIB_RESET(7474)
{
+ sub.do_reset();
+ }
+
+ NETLIB_RESET(7474sub)
+ {
m_CLK.set_state(logic_t::STATE_INP_LH);
- m_D.set_state(logic_t::STATE_INP_ACTIVE);
+
m_nextD = 0;
}
NETLIB_RESET(7474_dip)
{
+ // m_1.do_reset();
+ //m_2.do_reset();
}
NETLIB_UPDATE(7474_dip)
{
+ //m_1.update_dev();
+ //m_2.update_dev();
}
- NETLIB_DEVICE_IMPL(7474, "TTL_7474", "+CLK,+D,+CLRQ,+PREQ")
- NETLIB_DEVICE_IMPL(7474_dip, "TTL_7474_DIP", "")
+ NETLIB_DEVICE_IMPL(7474)
+ NETLIB_DEVICE_IMPL(7474_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7474.h b/src/lib/netlist/devices/nld_7474.h
index 48fd4f3d842..aa48e240387 100644
--- a/src/lib/netlist/devices/nld_7474.h
+++ b/src/lib/netlist/devices/nld_7474.h
@@ -42,7 +42,7 @@
#ifndef NLD_7474_H_
#define NLD_7474_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_7474(name, cCLK, cD, cCLRQ, cPREQ) \
NET_REGISTER_DEV(TTL_7474, name) \
diff --git a/src/lib/netlist/devices/nld_7475.cpp b/src/lib/netlist/devices/nld_7475.cpp
index 63fd355d406..b2d28048513 100644
--- a/src/lib/netlist/devices/nld_7475.cpp
+++ b/src/lib/netlist/devices/nld_7475.cpp
@@ -7,7 +7,7 @@
*/
#include "nld_7475.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -101,7 +101,7 @@ namespace netlist
{
unsigned start_q = m_last_Q;
- NETLIB_NAME(7477)::update();
+ NETLIB_PARENT_UPDATE(7477);
for (std::size_t i=0; i<4; i++)
{
@@ -148,10 +148,10 @@ namespace netlist
}
- NETLIB_DEVICE_IMPL(7475, "TTL_7475", "")
- NETLIB_DEVICE_IMPL(7475_dip, "TTL_7475_DIP", "")
- NETLIB_DEVICE_IMPL(7477, "TTL_7477", "")
- NETLIB_DEVICE_IMPL(7477_dip, "TTL_7477_DIP", "")
+ NETLIB_DEVICE_IMPL(7475)
+ NETLIB_DEVICE_IMPL(7475_dip)
+ NETLIB_DEVICE_IMPL(7477)
+ NETLIB_DEVICE_IMPL(7477_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7475.h b/src/lib/netlist/devices/nld_7475.h
index b16fabe61b6..51d09e75a66 100644
--- a/src/lib/netlist/devices/nld_7475.h
+++ b/src/lib/netlist/devices/nld_7475.h
@@ -35,7 +35,7 @@
#ifndef NLD_7475_H_
#define NLD_7475_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define PARAMS_7475_7477(name, cC1C2, cC3C4, cD1, cD2, cD3, cD4) \
NET_CONNECT(name, C1C2, cC1C2) \
diff --git a/src/lib/netlist/devices/nld_7483.cpp b/src/lib/netlist/devices/nld_7483.cpp
index 5f820162209..72c86c003d5 100644
--- a/src/lib/netlist/devices/nld_7483.cpp
+++ b/src/lib/netlist/devices/nld_7483.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_7483.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -16,16 +16,14 @@ namespace netlist
{
NETLIB_CONSTRUCTOR(7483)
, m_C0(*this, "C0")
- , m_A1(*this, "A1", NETLIB_DELEGATE(7483, upd_a))
- , m_A2(*this, "A2", NETLIB_DELEGATE(7483, upd_a))
- , m_A3(*this, "A3", NETLIB_DELEGATE(7483, upd_a))
- , m_A4(*this, "A4", NETLIB_DELEGATE(7483, upd_a))
- , m_B1(*this, "B1", NETLIB_DELEGATE(7483, upd_b))
- , m_B2(*this, "B2", NETLIB_DELEGATE(7483, upd_b))
- , m_B3(*this, "B3", NETLIB_DELEGATE(7483, upd_b))
- , m_B4(*this, "B4", NETLIB_DELEGATE(7483, upd_b))
- , m_a(*this, "m_a", 0)
- , m_b(*this, "m_b", 0)
+ , m_A1(*this, "A1")
+ , m_A2(*this, "A2")
+ , m_A3(*this, "A3")
+ , m_A4(*this, "A4")
+ , m_B1(*this, "B1")
+ , m_B2(*this, "B2")
+ , m_B3(*this, "B3")
+ , m_B4(*this, "B4")
, m_lastr(*this, "m_lastr", 0)
, m_S1(*this, "S1")
, m_S2(*this, "S2")
@@ -36,8 +34,6 @@ namespace netlist
}
NETLIB_RESETI();
NETLIB_UPDATEI();
- NETLIB_HANDLERI(upd_a);
- NETLIB_HANDLERI(upd_b);
protected:
logic_input_t m_C0;
@@ -50,9 +46,7 @@ namespace netlist
logic_input_t m_B3;
logic_input_t m_B4;
- state_var_u8 m_a;
- state_var_u8 m_b;
- state_var_u8 m_lastr;
+ state_var<unsigned> m_lastr;
logic_output_t m_S1;
logic_output_t m_S2;
@@ -93,21 +87,12 @@ namespace netlist
m_lastr = 0;
}
- NETLIB_HANDLER(7483, upd_a)
- {
- m_a = static_cast<uint8_t>((m_A1() << 0) | (m_A2() << 1) | (m_A3() << 2) | (m_A4() << 3));
- NETLIB_NAME(7483)::update();
- }
-
- NETLIB_HANDLER(7483, upd_b)
- {
- m_b = static_cast<uint8_t>((m_B1() << 0) | (m_B2() << 1) | (m_B3() << 2) | (m_B4() << 3));
- NETLIB_NAME(7483)::update();
- }
-
NETLIB_UPDATE(7483)
{
- auto r = static_cast<uint8_t>(m_a + m_b + m_C0());
+ netlist_sig_t a = (m_A1() << 0) | (m_A2() << 1) | (m_A3() << 2) | (m_A4() << 3);
+ netlist_sig_t b = (m_B1() << 0) | (m_B2() << 1) | (m_B3() << 2) | (m_B4() << 3);
+
+ unsigned r = a + b + m_C0();
if (r != m_lastr)
{
@@ -120,8 +105,8 @@ namespace netlist
}
}
- NETLIB_DEVICE_IMPL(7483, "TTL_7483", "+A1,+A2,+A3,+A4,+B1,+B2,+B3,+B4,+C0")
- NETLIB_DEVICE_IMPL(7483_dip, "TTL_7483_DIP", "")
+ NETLIB_DEVICE_IMPL(7483)
+ NETLIB_DEVICE_IMPL(7483_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7483.h b/src/lib/netlist/devices/nld_7483.h
index ba82d5bbb9c..24952bf0501 100644
--- a/src/lib/netlist/devices/nld_7483.h
+++ b/src/lib/netlist/devices/nld_7483.h
@@ -27,7 +27,7 @@
#ifndef NLD_7483_H_
#define NLD_7483_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_7483(name, cA1, cA2, cA3, cA4, cB1, cB2, cB3, cB4, cCI) \
NET_REGISTER_DEV(TTL_7483, name) \
diff --git a/src/lib/netlist/devices/nld_7485.cpp b/src/lib/netlist/devices/nld_7485.cpp
index cadb73000ff..320cf762f26 100644
--- a/src/lib/netlist/devices/nld_7485.cpp
+++ b/src/lib/netlist/devices/nld_7485.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_7485.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -101,8 +101,8 @@ namespace netlist
update_outputs(1, 1, 0);
}
- NETLIB_DEVICE_IMPL(7485, "TTL_7485", "+A0,+A1,+A2,+A3,+B0,+B1,+B2,+B3,+LTIN,+EQIN,+GTIN")
- NETLIB_DEVICE_IMPL(7485_dip, "TTL_7485_DIP", "")
+ NETLIB_DEVICE_IMPL(7485)
+ NETLIB_DEVICE_IMPL(7485_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7485.h b/src/lib/netlist/devices/nld_7485.h
index 7890f4dbd2a..61b87c37ba3 100644
--- a/src/lib/netlist/devices/nld_7485.h
+++ b/src/lib/netlist/devices/nld_7485.h
@@ -23,7 +23,7 @@
#ifndef NLD_7485_H_
#define NLD_7485_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_7485(name, cA0, cA1, cA2, cA3, cB0, cB1, cB2, cB3, cLTIN, cEQIN, cGTIN) \
NET_REGISTER_DEV(TTL_7485, name) \
diff --git a/src/lib/netlist/devices/nld_7490.cpp b/src/lib/netlist/devices/nld_7490.cpp
index acbe0fa4d7a..13e69c6aa31 100644
--- a/src/lib/netlist/devices/nld_7490.cpp
+++ b/src/lib/netlist/devices/nld_7490.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_7490.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -28,10 +28,10 @@ namespace netlist
{
}
- private:
NETLIB_UPDATEI();
NETLIB_RESETI();
+ protected:
void update_outputs();
logic_input_t m_A;
@@ -52,22 +52,22 @@ namespace netlist
{
NETLIB_CONSTRUCTOR_DERIVED(7490_dip, 7490)
{
- register_subalias("1", "B");
- register_subalias("2", "R1");
- register_subalias("3", "R2");
+ register_subalias("1", m_B);
+ register_subalias("2", m_R1);
+ register_subalias("3", m_R2);
// register_subalias("4", ); --> NC
// register_subalias("5", ); --> VCC
- register_subalias("6", "R91");
- register_subalias("7", "R92");
+ register_subalias("6", m_R91);
+ register_subalias("7", m_R92);
- register_subalias("8", "QC");
- register_subalias("9", "QB");
+ register_subalias("8", m_Q[2]);
+ register_subalias("9", m_Q[1]);
// register_subalias("10", ); --> GND
- register_subalias("11", "QD");
- register_subalias("12", "QA");
+ register_subalias("11", m_Q[3]);
+ register_subalias("12", m_Q[0]);
// register_subalias("13", ); --> NC
- register_subalias("14", "A");
+ register_subalias("14", m_A);
}
};
@@ -78,13 +78,12 @@ namespace netlist
m_last_B = 0;
}
- static constexpr const netlist_time delay[4] =
+ static C14CONSTEXPR const netlist_time delay[4] =
{
NLTIME_FROM_NS(18),
NLTIME_FROM_NS(36) - NLTIME_FROM_NS(18),
NLTIME_FROM_NS(54) - NLTIME_FROM_NS(18),
- NLTIME_FROM_NS(72) - NLTIME_FROM_NS(18)
- };
+ NLTIME_FROM_NS(72) - NLTIME_FROM_NS(18)};
NETLIB_UPDATE(7490)
{
@@ -120,14 +119,14 @@ namespace netlist
m_last_B = new_B;
}
- NETLIB_FUNC_VOID(7490, update_outputs, ())
+ NETLIB_FUNC_VOID(7490, update_outputs, (void))
{
for (std::size_t i=0; i<4; i++)
m_Q[i].push((m_cnt >> i) & 1, delay[i]);
}
- NETLIB_DEVICE_IMPL(7490, "TTL_7490", "+A,+B,+R1,+R2,+R91,+R92")
- NETLIB_DEVICE_IMPL(7490_dip, "TTL_7490_DIP", "")
+ NETLIB_DEVICE_IMPL(7490)
+ NETLIB_DEVICE_IMPL(7490_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7490.h b/src/lib/netlist/devices/nld_7490.h
index e2fa5094911..5ff18543b03 100644
--- a/src/lib/netlist/devices/nld_7490.h
+++ b/src/lib/netlist/devices/nld_7490.h
@@ -55,7 +55,7 @@
#ifndef NLD_7490_H_
#define NLD_7490_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_7490(name, cA, cB, cR1, cR2, cR91, cR92) \
NET_REGISTER_DEV(TTL_7490, name) \
diff --git a/src/lib/netlist/devices/nld_7493.cpp b/src/lib/netlist/devices/nld_7493.cpp
index f26e1c237d5..f3c68f7a5c2 100644
--- a/src/lib/netlist/devices/nld_7493.cpp
+++ b/src/lib/netlist/devices/nld_7493.cpp
@@ -6,22 +6,23 @@
*/
#include "nld_7493.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
namespace devices
{
- static constexpr const netlist_time out_delay = NLTIME_FROM_NS(18);
- static constexpr const netlist_time out_delay2 = NLTIME_FROM_NS(36);
- static constexpr const netlist_time out_delay3 = NLTIME_FROM_NS(54);
+ static constexpr netlist_time out_delay = NLTIME_FROM_NS(18);
+ static constexpr netlist_time out_delay2 = NLTIME_FROM_NS(36);
+ static constexpr netlist_time out_delay3 = NLTIME_FROM_NS(54);
NETLIB_OBJECT(7493)
{
NETLIB_CONSTRUCTOR(7493)
, m_R1(*this, "R1")
, m_R2(*this, "R2")
+ , m_reset(*this, "_m_reset", 0)
, m_a(*this, "_m_a", 0)
, m_bcd(*this, "_m_b", 0)
, m_CLKA(*this, "CLKA", NETLIB_DELEGATE(7493, updA))
@@ -34,51 +35,35 @@ namespace netlist
}
private:
- NETLIB_RESETI()
- {
- m_a = m_bcd = 0;
- m_CLKA.set_state(logic_t::STATE_INP_HL);
- m_CLKB.set_state(logic_t::STATE_INP_HL);
- }
+ NETLIB_RESETI();
+ NETLIB_UPDATEI();
- NETLIB_UPDATEI()
+ NETLIB_HANDLERI(updA)
{
- if (!(m_R1() & m_R2()))
- {
- m_CLKA.activate_hl();
- m_CLKB.activate_hl();
- }
- else
+ if (m_reset)
{
- m_CLKA.inactivate();
- m_CLKB.inactivate();
- m_QA.push(0, NLTIME_FROM_NS(40));
- m_QB.push(0, NLTIME_FROM_NS(40));
- m_QC.push(0, NLTIME_FROM_NS(40));
- m_QD.push(0, NLTIME_FROM_NS(40));
- m_a = m_bcd = 0;
+ m_a ^= 1;
+ m_QA.push(m_a, out_delay);
}
}
- NETLIB_HANDLERI(updA)
- {
- m_a ^= 1;
- m_QA.push(m_a, out_delay);
- }
-
NETLIB_HANDLERI(updB)
{
- auto cnt = (++m_bcd &= 0x07);
- m_QD.push((cnt >> 2) & 1, out_delay3);
- m_QC.push((cnt >> 1) & 1, out_delay2);
- m_QB.push(cnt & 1, out_delay);
+ if (m_reset)
+ {
+ ++m_bcd &= static_cast<std::uint8_t>(0x07);
+ m_QD.push((m_bcd >> 2) & 1, out_delay3);
+ m_QC.push((m_bcd >> 1) & 1, out_delay2);
+ m_QB.push(m_bcd & 1, out_delay);
+ }
}
logic_input_t m_R1;
logic_input_t m_R2;
+ state_var_sig m_reset;
state_var_sig m_a;
- state_var_u8 m_bcd;
+ state_var_sig m_bcd;
logic_input_t m_CLKA;
logic_input_t m_CLKB;
@@ -112,9 +97,37 @@ namespace netlist
}
};
+ NETLIB_RESET(7493)
+ {
+ m_reset = 1;
+ m_a = m_bcd = 0;
+ m_CLKA.set_state(logic_t::STATE_INP_HL);
+ m_CLKB.set_state(logic_t::STATE_INP_HL);
+ }
+
+ NETLIB_UPDATE(7493)
+ {
+ m_reset = (m_R1() & m_R2()) ^ 1;
+
+ if (m_reset)
+ {
+ m_CLKA.activate_hl();
+ m_CLKB.activate_hl();
+ }
+ else
+ {
+ m_CLKA.inactivate();
+ m_CLKB.inactivate();
+ m_QA.push_force(0, NLTIME_FROM_NS(40));
+ m_QB.push_force(0, NLTIME_FROM_NS(40));
+ m_QC.push_force(0, NLTIME_FROM_NS(40));
+ m_QD.push_force(0, NLTIME_FROM_NS(40));
+ m_a = m_bcd = 0;
+ }
+ }
- NETLIB_DEVICE_IMPL(7493, "TTL_7493", "+CLKA,+CLKB,+R1,+R2")
- NETLIB_DEVICE_IMPL(7493_dip, "TTL_7493_DIP", "")
+ NETLIB_DEVICE_IMPL(7493)
+ NETLIB_DEVICE_IMPL(7493_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7493.h b/src/lib/netlist/devices/nld_7493.h
index 68ad90885ec..ce9566aa28f 100644
--- a/src/lib/netlist/devices/nld_7493.h
+++ b/src/lib/netlist/devices/nld_7493.h
@@ -57,7 +57,7 @@
#ifndef NLD_7493_H_
#define NLD_7493_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_7493(name, cCLKA, cCLKB, cR1, cR2) \
NET_REGISTER_DEV(TTL_7493, name) \
diff --git a/src/lib/netlist/devices/nld_7497.cpp b/src/lib/netlist/devices/nld_7497.cpp
deleted file mode 100644
index 1432884b8dd..00000000000
--- a/src/lib/netlist/devices/nld_7497.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Sergey Svishchev
-/*
- * nld_7497.cpp
- *
- * To do:
- *
- * - STRB and EN
- * - Timing
- */
-
-#include "nld_7497.h"
-#include "netlist/nl_base.h"
-
-namespace netlist
-{
- namespace devices
- {
-
- static constexpr const netlist_time out_delay_CLK_Y[2] = { NLTIME_FROM_NS(20), NLTIME_FROM_NS(26) }; // tPHL, tPLH
- static constexpr const netlist_time out_delay_CLK_Z[2] = { NLTIME_FROM_NS(17), NLTIME_FROM_NS(12) };
-
- NETLIB_OBJECT(7497)
- {
- NETLIB_CONSTRUCTOR(7497)
- , m_B(*this, {{"B5", "B4", "B3", "B2", "B1", "B0"}})
- , m_CLK(*this, "CLK", NETLIB_DELEGATE(7497, clk_strb))
- , m_STRBQ(*this, "STRBQ", NETLIB_DELEGATE(7497, clk_strb))
- , m_ENQ(*this, "ENQ")
- , m_UNITYQ(*this, "UNITYQ", NETLIB_DELEGATE(7497, unity))
- , m_CLR(*this, "CLR", NETLIB_DELEGATE(7497, clr))
- , m_Y(*this, "Y")
- , m_ZQ(*this, "ZQ")
- , m_ENOUTQ(*this, "ENOUTQ")
- , m_cnt(*this, "_m_cnt", 0)
- , m_rate(*this, "_m_rate", 0)
- , m_state(*this, "_m_state", 0)
- , m_lastclock(*this, "_m_lastclock", 0)
- {
- }
-
- private:
- NETLIB_RESETI();
- NETLIB_UPDATEI();
-
- NETLIB_HANDLERI(noop) { }
- NETLIB_HANDLERI(unity);
- NETLIB_HANDLERI(clr);
- NETLIB_HANDLERI(clk_strb);
-
- protected:
- object_array_t<logic_input_t, 6> m_B;
- logic_input_t m_CLK;
- logic_input_t m_STRBQ;
- logic_input_t m_ENQ;
- logic_input_t m_UNITYQ;
- logic_input_t m_CLR;
-
- logic_output_t m_Y;
- logic_output_t m_ZQ;
- logic_output_t m_ENOUTQ;
-
- state_var_u8 m_cnt;
- state_var_u8 m_rate;
- state_var_sig m_state;
- state_var_sig m_lastclock;
-
- void newstate(const netlist_sig_t state)
- {
- m_state = state;
- m_ZQ.push(state, out_delay_CLK_Z[state]);
- //netlist_sig_t y = (state ^ 1) | (m_UNITY() ^ 1); // OR with negated inputs == NAND
- netlist_sig_t y = (state & m_UNITYQ()) ^ 1; // OR with negated inputs == NAND
- m_Y.push(y, out_delay_CLK_Y[y]);
- }
-
- uint8_t rate()
- {
- uint8_t a = 0;
-
- for (std::size_t i = 0; i < 6; i++)
- a |= (m_B[i]() << i);
-
- return a;
- }
- };
-
- NETLIB_RESET(7497)
- {
- m_cnt = 0;
- m_rate = 0;
- m_lastclock = 0;
- }
-
- NETLIB_UPDATE(7497)
- {
- m_rate = rate();
- clk_strb();
- }
-
- NETLIB_HANDLER(7497, unity)
- {
- newstate (m_state);
- }
-
- NETLIB_HANDLER(7497, clr)
- {
- m_cnt = 0;
- clk_strb();
- }
-
- NETLIB_HANDLER(7497, clk_strb)
- {
- netlist_sig_t clk = m_CLK();
-
- if (!m_lastclock && clk && !m_ENQ() && !m_CLR())
- {
- m_cnt++;
- m_cnt &= 63;
- }
- m_lastclock = clk;
-
- const netlist_sig_t clk_strb = (clk ^ 1) & (m_STRBQ() ^ 1);
-
- const netlist_sig_t cntQ = m_cnt;
-
- // NOR GATE
- netlist_sig_t p1 = ((cntQ & 63) == 31 && (m_rate & 32)) ||
- ((cntQ & 31) == 15 && (m_rate & 16)) ||
- ((cntQ & 15) == 7 && (m_rate & 8)) ||
- ((cntQ & 7) == 3 && (m_rate & 4)) ||
- ((cntQ & 3) == 1 && (m_rate & 2)) ||
- ((cntQ & 1) == 0 && (m_rate & 1));
-
- p1 = (p1 & clk_strb) ^ 1;
-
- newstate(p1);
-
- // NAND gate
- if ((m_cnt == 63) && !m_ENQ())
- m_ENOUTQ.push(0, out_delay_CLK_Y[0]); // XXX timing
- else
- m_ENOUTQ.push(1, out_delay_CLK_Y[1]);
-
- }
-
- NETLIB_OBJECT_DERIVED(7497_dip, 7497)
- {
- NETLIB_CONSTRUCTOR_DERIVED(7497_dip, 7497)
- {
- register_subalias("1", m_B[4]); // B0
- register_subalias("2", m_B[1]); // B4
- register_subalias("3", m_B[0]); // B5
- register_subalias("4", m_B[5]); // B0
- register_subalias("5", m_ZQ);
- register_subalias("6", m_Y);
- register_subalias("7", m_ENOUTQ);
-
- register_subalias("9", m_CLK);
- register_subalias("10", m_STRBQ);
- register_subalias("11", m_UNITYQ);
- register_subalias("12", m_ENQ);
- register_subalias("13", m_CLR);
- register_subalias("14", m_B[3]); // B2
- register_subalias("15", m_B[2]); // B3
- }
- };
-
-
- NETLIB_DEVICE_IMPL(7497, "TTL_7497", "+CLK,+STRBQ,+ENQ,+UNITYQ,+CLR,+B0,+B1,+B2,+B3,+B4,+B5")
- NETLIB_DEVICE_IMPL(7497_dip, "TTL_7497_DIP", "")
-
- } //namespace devices
-} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_7497.h b/src/lib/netlist/devices/nld_7497.h
deleted file mode 100644
index 8d14e08a49b..00000000000
--- a/src/lib/netlist/devices/nld_7497.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Sergey Svishchev
-/*
- * nld_7497.h
- *
- * SN7497: Synchronous 6-Bit Binary Rate Multiplier
- *
- * +--------------+
- * B1 |1 16| VCC
- * B4 |2 15| B3
- * B5 |3 14| B2
- * B0 |4 7497 13| CLR
- * Z |5 12| UNITY/CAS
- * Y |6 11| ENin (EN)
- * ENout |7 10| STRB
- * GND |8 9| CLK
- * +--------------+
- *
- * Naming conventions follow TI datasheet
- *
- * The counter is enabled when the clear, strobe, and enable inputs are low.
- *
- * When the rate input is binary 0 (all rate inputs low), Z remains high [and Y low].
- *
- * The unity/cascade input, when connected to the clock input, passes
- * clock frequency (inverted) to the Y output when the rate input/decoding
- * gates are inhibited by the strobe.
- *
- * When CLR is H, states of CLK and STRB can affect Y and Z. Default are
- * Y L, Z H, ENout H.
- *
- * Unity/cascade is used to inhibit output Y (UNITY L -> Y H)
- */
-
-#ifndef NLD_7497_H_
-#define NLD_7497_H_
-
-#include "netlist/nl_setup.h"
-
-#define TTL_7497(name, cCLK, cSTRB, cEN, cUNITY, cCLR, cB0, cB1, cB2, cB3, cB4, cB5) \
- NET_REGISTER_DEV(TTL_7497, name) \
- NET_CONNECT(name, CLK, cCLK) \
- NET_CONNECT(name, STRBQ, cSTRB) \
- NET_CONNECT(name, ENQ, cEN) \
- NET_CONNECT(name, UNITYQ,cUNITY) \
- NET_CONNECT(name, CLR, cCLR) \
- NET_CONNECT(name, B0, cB0) \
- NET_CONNECT(name, B1, cB1) \
- NET_CONNECT(name, B2, cB2) \
- NET_CONNECT(name, B3, cB3) \
- NET_CONNECT(name, B4, cB4) \
- NET_CONNECT(name, B5, cB5)
-
-#define TTL_7497_DIP(name) \
- NET_REGISTER_DEV(TTL_7497_DIP, name)
-
-#endif /* NLD_7497_H_ */
diff --git a/src/lib/netlist/devices/nld_74ls629.cpp b/src/lib/netlist/devices/nld_74ls629.cpp
index b7bb729b334..d6dc268ed28 100644
--- a/src/lib/netlist/devices/nld_74ls629.cpp
+++ b/src/lib/netlist/devices/nld_74ls629.cpp
@@ -40,7 +40,7 @@
#include "nld_74ls629.h"
-#include "netlist/analog/nlid_twoterm.h"
+#include "../analog/nlid_twoterm.h"
namespace netlist
{
@@ -100,14 +100,11 @@ namespace netlist
{
m_R_FC.set_R(90000.0);
m_R_RNG.set_R(90000.0);
- m_clock.reset();
+ m_clock.do_reset();
}
NETLIB_UPDATEI();
- NETLIB_UPDATE_PARAMI()
- {
- /* update param may be called from anywhere, update_dev(time) is not a good idea */
- }
+ NETLIB_UPDATE_PARAMI() { update_dev(); }
public:
NETLIB_SUB(SN74LS629clk) m_clock;
@@ -148,8 +145,8 @@ namespace netlist
NETLIB_RESETI()
{
- m_1.reset();
- m_2.reset();
+ m_1.do_reset();
+ m_2.do_reset();
}
private:
@@ -210,7 +207,7 @@ namespace netlist
freq += k9 * v_rng * v_freq_3;
freq += k10 * v_rng * v_freq_4;
- freq *= plib::constants<nl_double>::cast(0.1e-6) / m_CAP();
+ freq *= NL_FCONST(0.1e-6) / m_CAP();
// FIXME: we need a possibility to remove entries from queue ...
// or an exact model ...
@@ -234,8 +231,8 @@ namespace netlist
}
}
- NETLIB_DEVICE_IMPL(SN74LS629, "SN74LS629", "CAP")
- NETLIB_DEVICE_IMPL(SN74LS629_dip, "SN74LS629_DIP", "1.CAP1,2.CAP2")
+ NETLIB_DEVICE_IMPL(SN74LS629)
+ NETLIB_DEVICE_IMPL(SN74LS629_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_74ls629.h b/src/lib/netlist/devices/nld_74ls629.h
index 30d15d70865..3351524a60b 100644
--- a/src/lib/netlist/devices/nld_74ls629.h
+++ b/src/lib/netlist/devices/nld_74ls629.h
@@ -28,7 +28,7 @@
#ifndef NLD_74LS629_H_
#define NLD_74LS629_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define SN74LS629(name, p_cap) \
NET_REGISTER_DEV(SN74LS629, name) \
diff --git a/src/lib/netlist/devices/nld_82S115.cpp b/src/lib/netlist/devices/nld_82S115.cpp
index 8ae6cbb6097..2e24bbf9fed 100644
--- a/src/lib/netlist/devices/nld_82S115.cpp
+++ b/src/lib/netlist/devices/nld_82S115.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_82S115.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -106,8 +106,8 @@ namespace netlist
m_O[i].push((o >> i) & 1, NLTIME_FROM_NS(40)); // FIXME: Timing
}
- NETLIB_DEVICE_IMPL(82S115, "PROM_82S115", "+CE1Q,+CE2,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+STROBE")
- NETLIB_DEVICE_IMPL(82S115_dip, "PROM_82S115_DIP", "")
+ NETLIB_DEVICE_IMPL(82S115)
+ NETLIB_DEVICE_IMPL(82S115_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_82S115.h b/src/lib/netlist/devices/nld_82S115.h
index 8c13fd8b51e..ef7f1ec3910 100644
--- a/src/lib/netlist/devices/nld_82S115.h
+++ b/src/lib/netlist/devices/nld_82S115.h
@@ -28,7 +28,7 @@
#ifndef NLD_82S115_H_
#define NLD_82S115_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define PROM_82S115(name, cCE1Q, cCE2, cA0, cA1, cA2, cA3, cA4, cA5, cA6, cA7, cA8, cSTROBE) \
NET_REGISTER_DEV(PROM_82S115, name) \
diff --git a/src/lib/netlist/devices/nld_82S123.cpp b/src/lib/netlist/devices/nld_82S123.cpp
index 4a80b57e349..a8a6bfc9b57 100644
--- a/src/lib/netlist/devices/nld_82S123.cpp
+++ b/src/lib/netlist/devices/nld_82S123.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_82S123.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -77,8 +77,8 @@ namespace netlist
m_O[i].push((o >> i) & 1, delay);
}
- NETLIB_DEVICE_IMPL(82S123, "PROM_82S123", "+CEQ,+A0,+A1,+A2,+A3,+A4")
- NETLIB_DEVICE_IMPL(82S123_dip, "PROM_82S123_DIP", "")
+ NETLIB_DEVICE_IMPL(82S123)
+ NETLIB_DEVICE_IMPL(82S123_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_82S123.h b/src/lib/netlist/devices/nld_82S123.h
index 2c18377934d..dbf6bf63180 100644
--- a/src/lib/netlist/devices/nld_82S123.h
+++ b/src/lib/netlist/devices/nld_82S123.h
@@ -25,7 +25,7 @@
#ifndef NLD_82S123_H_
#define NLD_82S123_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define PROM_82S123(name, cCEQ, cA0, cA1, cA2, cA3, cA4) \
NET_REGISTER_DEV(PROM_82S123, name) \
diff --git a/src/lib/netlist/devices/nld_82S126.cpp b/src/lib/netlist/devices/nld_82S126.cpp
index b1752908645..dcacd1ec876 100644
--- a/src/lib/netlist/devices/nld_82S126.cpp
+++ b/src/lib/netlist/devices/nld_82S126.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_82S126.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -79,8 +79,8 @@ namespace netlist
m_O[i].push((o >> i) & 1, delay);
}
- NETLIB_DEVICE_IMPL(82S126, "PROM_82S126", "+CE1Q,+CE2Q,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7")
- NETLIB_DEVICE_IMPL(82S126_dip, "PROM_82S126_DIP", "")
+ NETLIB_DEVICE_IMPL(82S126)
+ NETLIB_DEVICE_IMPL(82S126_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_82S126.h b/src/lib/netlist/devices/nld_82S126.h
index ed7aa131819..3079bb8e2e0 100644
--- a/src/lib/netlist/devices/nld_82S126.h
+++ b/src/lib/netlist/devices/nld_82S126.h
@@ -24,7 +24,7 @@
#ifndef NLD_82S126_H_
#define NLD_82S126_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define PROM_82S126(name, cCE1Q, cCE2Q, cA0, cA1, cA2, cA3, cA4, cA5, cA6, cA7) \
NET_REGISTER_DEV(PROM_82S126, name) \
diff --git a/src/lib/netlist/devices/nld_82S16.cpp b/src/lib/netlist/devices/nld_82S16.cpp
index e3176c7b30f..7441f6c677e 100644
--- a/src/lib/netlist/devices/nld_82S16.cpp
+++ b/src/lib/netlist/devices/nld_82S16.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_82S16.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -15,55 +15,19 @@ namespace netlist
NETLIB_OBJECT(82S16)
{
NETLIB_CONSTRUCTOR(82S16)
- , m_A(*this, {{"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7" }}, NETLIB_DELEGATE(82S16, addr))
- , m_CE1Q(*this, "CE1Q", NETLIB_DELEGATE(82S16, enq))
- , m_CE2Q(*this, "CE2Q", NETLIB_DELEGATE(82S16, enq))
- , m_CE3Q(*this, "CE3Q", NETLIB_DELEGATE(82S16, enq))
+ , m_A(*this, {{"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7" }})
+ , m_CE1Q(*this, "CE1Q")
+ , m_CE2Q(*this, "CE2Q")
+ , m_CE3Q(*this, "CE3Q")
, m_WEQ(*this, "WEQ")
, m_DIN(*this, "DIN")
, m_DOUTQ(*this, "DOUTQ")
, m_ram(*this, "m_ram", 0)
- , m_addr(*this, "m_addr", 0)
- , m_enq(*this, "m_enq", 0)
{
}
NETLIB_RESETI();
NETLIB_UPDATEI();
- NETLIB_HANDLERI(addr)
- {
- uint8_t adr = 0;
- for (std::size_t i=0; i<8; i++)
- {
- //m_A[i].activate();
- adr |= (m_A[i]() << i);
- }
- m_addr = adr;
- NETLIB_NAME(82S16)::update();
- }
- NETLIB_HANDLERI(enq)
- {
- const auto last = m_enq;
- m_enq = m_CE1Q() || m_CE2Q() || m_CE3Q();
- if (!last && m_enq)
- {
- // FIXME: Outputs are tristate. This needs to be properly implemented
- m_DOUTQ.push(1, NLTIME_FROM_NS(20));
- for (std::size_t i=0; i<8; i++)
- m_A[i].inactivate();
- m_WEQ.inactivate();
- m_DIN.inactivate();
- }
- else if (last && !m_enq)
- {
- for (std::size_t i=0; i<8; i++)
- m_A[i].activate();
- m_WEQ.activate();
- m_DIN.activate();
- NETLIB_NAME(82S16)::update();
- }
- }
-
protected:
object_array_t<logic_input_t, 8> m_A;
@@ -74,9 +38,7 @@ namespace netlist
logic_input_t m_DIN;
logic_output_t m_DOUTQ;
- state_array<uint64_t, 4> m_ram; // 256 bits
- state_var_u8 m_addr; // 256 bits
- state_var_sig m_enq;
+ state_var<uint64_t[4]> m_ram; // 256 bits
};
NETLIB_OBJECT_DERIVED(82S16_dip, 82S16)
@@ -107,9 +69,22 @@ namespace netlist
// FIXME: optimize device (separate address decoder!)
NETLIB_UPDATE(82S16)
{
- if (!m_enq)
+ if (m_CE1Q() || m_CE2Q() || m_CE3Q())
{
- const auto adr(m_addr);
+ // FIXME: Outputs are tristate. This needs to be properly implemented
+ m_DOUTQ.push(1, NLTIME_FROM_NS(20));
+ //for (int i=0; i<8; i++)
+ //m_A[i].inactivate();
+ }
+ else
+ {
+ unsigned int adr = 0;
+ for (std::size_t i=0; i<8; i++)
+ {
+ //m_A[i].activate();
+ adr |= (m_A[i]() << i);
+ }
+
if (!m_WEQ())
{
m_ram[adr >> 6] = (m_ram[adr >> 6]
@@ -126,12 +101,10 @@ namespace netlist
{
m_ram[i] = 0;
}
- m_addr = 0;
- m_enq = 0;
}
- NETLIB_DEVICE_IMPL(82S16, "TTL_82S16", "")
- NETLIB_DEVICE_IMPL(82S16_dip, "TTL_82S16_DIP", "")
+ NETLIB_DEVICE_IMPL(82S16)
+ NETLIB_DEVICE_IMPL(82S16_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_82S16.h b/src/lib/netlist/devices/nld_82S16.h
index 47d6189a79b..d1117246d87 100644
--- a/src/lib/netlist/devices/nld_82S16.h
+++ b/src/lib/netlist/devices/nld_82S16.h
@@ -24,7 +24,7 @@
#ifndef NLD_82S16_H_
#define NLD_82S16_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_82S16(name) \
NET_REGISTER_DEV(TTL_82S16, name)
diff --git a/src/lib/netlist/devices/nld_9310.cpp b/src/lib/netlist/devices/nld_9310.cpp
index b416015df24..ad752adb605 100644
--- a/src/lib/netlist/devices/nld_9310.cpp
+++ b/src/lib/netlist/devices/nld_9310.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_9310.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
#define MAXCNT 9
@@ -14,7 +14,6 @@ namespace netlist
{
namespace devices
{
- //FIXME: Convert sub devices into NETDEV_DELEGATE logic
NETLIB_OBJECT(9310_subABCD)
{
NETLIB_CONSTRUCTOR(9310_subABCD)
@@ -140,8 +139,8 @@ namespace netlist
NETLIB_RESET(9310)
{
- sub.reset();
- subABCD.reset();
+ sub.do_reset();
+ subABCD.do_reset();
}
NETLIB_RESET(9310_subABCD)
@@ -158,35 +157,32 @@ namespace netlist
NETLIB_UPDATE(9310_sub)
{
- auto cnt(m_cnt);
-
if (m_loadq)
{
- if (cnt < MAXCNT - 1)
+ if (m_cnt < MAXCNT - 1)
{
- ++cnt;
- update_outputs(cnt);
+ ++m_cnt;
+ update_outputs(m_cnt);
}
- else if (cnt == MAXCNT - 1)
+ else if (m_cnt == MAXCNT - 1)
{
- cnt = MAXCNT;
+ m_cnt = MAXCNT;
m_RC.push(m_ent, NLTIME_FROM_NS(20));
m_QA.push(1, NLTIME_FROM_NS(20));
}
else // MAXCNT
{
m_RC.push(0, NLTIME_FROM_NS(20));
- cnt = 0;
- update_outputs_all(cnt, NLTIME_FROM_NS(20));
+ m_cnt = 0;
+ update_outputs_all(m_cnt, NLTIME_FROM_NS(20));
}
}
else
{
- cnt = m_ABCD->read_ABCD();
- m_RC.push(m_ent & (cnt == MAXCNT), NLTIME_FROM_NS(27));
- update_outputs_all(cnt, NLTIME_FROM_NS(22));
+ m_cnt = m_ABCD->read_ABCD();
+ m_RC.push(m_ent & (m_cnt == MAXCNT), NLTIME_FROM_NS(27));
+ update_outputs_all(m_cnt, NLTIME_FROM_NS(22));
}
- m_cnt = cnt;
}
NETLIB_UPDATE(9310)
@@ -227,10 +223,10 @@ namespace netlist
#if 0
// for (int i=0; i<4; i++)
// m_Q[i], (cnt >> i) & 1, delay[i]);
- m_QA.push((cnt >> 0) & 1, out_delay);
- m_QB.push((cnt >> 1) & 1, out_delay);
- m_QC.push((cnt >> 2) & 1, out_delay);
- m_QD.push((cnt >> 3) & 1, out_delay);
+ m_QA, (cnt >> 0) & 1, out_delay);
+ m_QB, (cnt >> 1) & 1, out_delay);
+ m_QC, (cnt >> 2) & 1, out_delay);
+ m_QD, (cnt >> 3) & 1, out_delay);
#else
if ((cnt & 1) == 1)
m_QA.push(1, out_delay);
@@ -266,8 +262,8 @@ namespace netlist
#endif
}
- NETLIB_DEVICE_IMPL(9310, "TTL_9310", "")
- NETLIB_DEVICE_IMPL(9310_dip, "TTL_9310_DIP", "")
+ NETLIB_DEVICE_IMPL(9310)
+ NETLIB_DEVICE_IMPL(9310_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_9310.h b/src/lib/netlist/devices/nld_9310.h
index 65df9c04ce4..02cb45b2d86 100644
--- a/src/lib/netlist/devices/nld_9310.h
+++ b/src/lib/netlist/devices/nld_9310.h
@@ -45,7 +45,7 @@
#ifndef NLD_9310_H_
#define NLD_9310_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_9310(name, cCLK, cENP, cENT, cCLRQ, cLOADQ, cA, cB, cC, cD) \
NET_REGISTER_DEV(TTL_9310, name) \
diff --git a/src/lib/netlist/devices/nld_9316.cpp b/src/lib/netlist/devices/nld_9316.cpp
index 2b17eabb3ec..7c478fd4b05 100644
--- a/src/lib/netlist/devices/nld_9316.cpp
+++ b/src/lib/netlist/devices/nld_9316.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_9316.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -20,73 +20,32 @@ namespace netlist
NETLIB_CONSTRUCTOR(9316)
, m_CLK(*this, "CLK", NETLIB_DELEGATE(9316, clk))
, m_ENT(*this, "ENT")
- , m_RC(*this, "RC")
, m_LOADQ(*this, "LOADQ")
+ , m_cnt(*this, "m_cnt", 0)
, m_ENP(*this, "ENP")
, m_CLRQ(*this, "CLRQ")
- , m_A(*this, "A", NETLIB_DELEGATE(9316, abcd))
- , m_B(*this, "B", NETLIB_DELEGATE(9316, abcd))
- , m_C(*this, "C", NETLIB_DELEGATE(9316, abcd))
- , m_D(*this, "D", NETLIB_DELEGATE(9316, abcd))
+ , m_A(*this, "A", NETLIB_DELEGATE(9316, noop))
+ , m_B(*this, "B", NETLIB_DELEGATE(9316, noop))
+ , m_C(*this, "C", NETLIB_DELEGATE(9316, noop))
+ , m_D(*this, "D", NETLIB_DELEGATE(9316, noop))
, m_Q(*this, {{ "QA", "QB", "QC", "QD" }})
- , m_cnt(*this, "m_cnt", 0)
- , m_abcd(*this, "m_abcd", 0)
- , m_loadq(*this, "m_loadq", 0)
- , m_ent(*this, "m_ent", 0)
+ , m_RC(*this, "RC")
{
}
private:
- NETLIB_RESETI()
- {
- m_CLK.set_state(logic_t::STATE_INP_LH);
- m_cnt = 0;
- m_abcd = 0;
- }
-
- NETLIB_UPDATEI()
- {
- const auto CLRQ(m_CLRQ());
- m_ent = m_ENT();
- m_loadq = m_LOADQ();
-
- if (((m_loadq ^ 1) || (m_ent && m_ENP())) && CLRQ)
- {
- m_CLK.activate_lh();
- }
- else
- {
- m_CLK.inactivate();
- if (!CLRQ && (m_cnt>0))
- {
- m_cnt = 0;
- update_outputs_all(m_cnt, NLTIME_FROM_NS(36));
- }
- }
- m_RC.push(m_ent && (m_cnt == MAXCNT), NLTIME_FROM_NS(27));
- }
-
-
- NETLIB_HANDLERI(clk)
- {
- auto cnt = (m_loadq ? m_cnt + 1 : m_abcd) & MAXCNT;
- m_RC.push(m_ent && (cnt == MAXCNT), NLTIME_FROM_NS(27));
- update_outputs_all(cnt, NLTIME_FROM_NS(20));
- m_cnt = cnt;
- }
-
- NETLIB_HANDLERI(abcd)
- {
- m_abcd = static_cast<uint8_t>((m_D() << 3) | (m_C() << 2) | (m_B() << 1) | (m_A() << 0));
- }
+ NETLIB_RESETI();
+ NETLIB_UPDATEI();
+ NETLIB_HANDLERI(clk);
+ NETLIB_HANDLERI(noop) { }
logic_input_t m_CLK;
- logic_input_t m_ENT;
-
- logic_output_t m_RC;
+ logic_input_t m_ENT;
logic_input_t m_LOADQ;
+ state_var<unsigned> m_cnt;
+
logic_input_t m_ENP;
logic_input_t m_CLRQ;
@@ -96,15 +55,12 @@ namespace netlist
logic_input_t m_D;
object_array_t<logic_output_t, 4> m_Q;
+ logic_output_t m_RC;
- /* counter state */
- state_var<unsigned> m_cnt;
- /* cached pins */
- state_var_u8 m_abcd;
- state_var_sig m_loadq;
- state_var_sig m_ent;
- void update_outputs_all(unsigned cnt, netlist_time out_delay) noexcept
+ private:
+ //inline void update_outputs_all(const unsigned &cnt, const netlist_time &out_delay) noexcept
+ inline void update_outputs_all(const unsigned &cnt, const netlist_time &out_delay) noexcept
{
m_Q[0].push((cnt >> 0) & 1, out_delay);
m_Q[1].push((cnt >> 1) & 1, out_delay);
@@ -137,9 +93,63 @@ namespace netlist
}
};
+ NETLIB_RESET(9316)
+ {
+ m_CLK.set_state(logic_t::STATE_INP_LH);
+ m_cnt = 0;
+ }
+
+ NETLIB_HANDLER(9316, clk)
+ {
+ if (m_LOADQ())
+ {
+ ++m_cnt &= MAXCNT;
+ //m_RC.push(m_ENT() && (m_cnt == MAXCNT), NLTIME_FROM_NS(27));
+ if (m_cnt == MAXCNT)
+ {
+ m_RC.push(m_ENT(), NLTIME_FROM_NS(27));
+ update_outputs_all(MAXCNT, NLTIME_FROM_NS(20));
+ }
+ else if (m_cnt == 0)
+ {
+ m_RC.push(0, NLTIME_FROM_NS(27));
+ update_outputs_all(0, NLTIME_FROM_NS(20));
+ }
+ else
+ update_outputs_all(m_cnt, NLTIME_FROM_NS(20));
+ }
+ else
+ {
+ m_cnt = (m_D() << 3) | (m_C() << 2) | (m_B() << 1) | (m_A() << 0);
+ m_RC.push(m_ENT() && (m_cnt == MAXCNT), NLTIME_FROM_NS(27));
+ update_outputs_all(m_cnt, NLTIME_FROM_NS(22));
+ }
+ }
+
+ NETLIB_UPDATE(9316)
+ {
+ const netlist_sig_t CLRQ(m_CLRQ());
+ const netlist_sig_t ENT(m_ENT());
+
+ if (((m_LOADQ() ^ 1) || (ENT && m_ENP())) && CLRQ)
+ {
+ m_CLK.activate_lh();
+ }
+ else
+ {
+ m_CLK.inactivate();
+ if (!CLRQ && (m_cnt>0))
+ {
+ m_cnt = 0;
+ update_outputs_all(m_cnt, NLTIME_FROM_NS(36));
+ }
+ }
+ m_RC.push(ENT && (m_cnt == MAXCNT), NLTIME_FROM_NS(27));
+ }
+
- NETLIB_DEVICE_IMPL(9316, "TTL_9316", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D")
- NETLIB_DEVICE_IMPL(9316_dip, "TTL_9316_DIP", "")
+ NETLIB_DEVICE_IMPL(9316)
+ NETLIB_DEVICE_IMPL(9316_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_9316.h b/src/lib/netlist/devices/nld_9316.h
index 8ab1789d7c7..8deb21dfccd 100644
--- a/src/lib/netlist/devices/nld_9316.h
+++ b/src/lib/netlist/devices/nld_9316.h
@@ -51,7 +51,7 @@
#ifndef NLD_9316_H_
#define NLD_9316_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_9316(name, cCLK, cENP, cENT, cCLRQ, cLOADQ, cA, cB, cC, cD) \
NET_REGISTER_DEV(TTL_9316, name) \
diff --git a/src/lib/netlist/devices/nld_9322.cpp b/src/lib/netlist/devices/nld_9322.cpp
index abf9bf9f6ef..6c408498be7 100644
--- a/src/lib/netlist/devices/nld_9322.cpp
+++ b/src/lib/netlist/devices/nld_9322.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_9322.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -105,14 +105,14 @@ namespace netlist
NETLIB_UPDATE(9322)
{
- m_1.update();
- m_2.update();
- m_3.update();
- m_4.update();
+ m_1.update_dev();
+ m_2.update_dev();
+ m_3.update_dev();
+ m_4.update_dev();
}
- NETLIB_DEVICE_IMPL(9322, "TTL_9322", "+SELECT,+A1,+B1,+A2,+B2,+A3,+B3,+A4,+B4,+STROBE")
- NETLIB_DEVICE_IMPL(9322_dip, "TTL_9322_DIP", "")
+ NETLIB_DEVICE_IMPL(9322)
+ NETLIB_DEVICE_IMPL(9322_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_9322.h b/src/lib/netlist/devices/nld_9322.h
index 986c6b9e7f7..7de0f053b05 100644
--- a/src/lib/netlist/devices/nld_9322.h
+++ b/src/lib/netlist/devices/nld_9322.h
@@ -21,7 +21,7 @@
#ifndef NLD_9322_H_
#define NLD_9322_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_9322(name, cSELECT, cA1, cB1, cA2, cB2, cA3, cB3, cA4, cB4, cSTROBE) \
NET_REGISTER_DEV(TTL_9322, name) \
diff --git a/src/lib/netlist/devices/nld_am2847.cpp b/src/lib/netlist/devices/nld_am2847.cpp
index 825696f0938..5d0c5cb71a3 100644
--- a/src/lib/netlist/devices/nld_am2847.cpp
+++ b/src/lib/netlist/devices/nld_am2847.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_am2847.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -30,7 +30,7 @@ namespace netlist
logic_input_t m_RC;
logic_input_t m_IN;
- state_array<uint16_t, 5> m_buffer;
+ state_var<uint16_t[5]> m_buffer;
logic_output_t m_OUT;
};
@@ -116,7 +116,7 @@ namespace netlist
/* do nothing */
}
- NETLIB_FUNC_VOID(Am2847_shifter, shift, ())
+ inline NETLIB_FUNC_VOID(Am2847_shifter, shift, (void))
{
uint32_t out = m_buffer[0] & 1;
uint32_t in = (m_RC() ? out : m_IN());
@@ -130,8 +130,8 @@ namespace netlist
m_OUT.push(out, NLTIME_FROM_NS(200));
}
- NETLIB_DEVICE_IMPL(AM2847, "TTL_AM2847", "+CP,+INA,+INB,+INC,+IND,+RCA,+RCB,+RCC,+RCD")
- NETLIB_DEVICE_IMPL(AM2847_dip, "TTL_AM2847_DIP", "")
+ NETLIB_DEVICE_IMPL(AM2847)
+ NETLIB_DEVICE_IMPL(AM2847_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_am2847.h b/src/lib/netlist/devices/nld_am2847.h
index ff4a95b8e81..70d288d3eec 100644
--- a/src/lib/netlist/devices/nld_am2847.h
+++ b/src/lib/netlist/devices/nld_am2847.h
@@ -21,7 +21,7 @@
#ifndef NLD_AM2847_H_
#define NLD_AM2847_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_AM2847(name, cCP, cINA, cINB, cINC, cIND, cRCA, cRCB, cRCC, cRCD) \
NET_REGISTER_DEV(TTL_AM2847, name) \
diff --git a/src/lib/netlist/devices/nld_dm9314.cpp b/src/lib/netlist/devices/nld_dm9314.cpp
index 93b958de539..fd3b8666078 100644
--- a/src/lib/netlist/devices/nld_dm9314.cpp
+++ b/src/lib/netlist/devices/nld_dm9314.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_dm9314.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -107,8 +107,8 @@ namespace netlist
}
}
- NETLIB_DEVICE_IMPL(9314, "TTL_9314", "+EQ,+MRQ,+S0Q,+S1Q,+S2Q,+S3Q,+D0,+D1,+D2,+D3")
- NETLIB_DEVICE_IMPL(9314_dip, "TTL_9314_DIP", "")
+ NETLIB_DEVICE_IMPL(9314)
+ NETLIB_DEVICE_IMPL(9314_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_dm9314.h b/src/lib/netlist/devices/nld_dm9314.h
index 59c60591ce7..6188bbef42f 100644
--- a/src/lib/netlist/devices/nld_dm9314.h
+++ b/src/lib/netlist/devices/nld_dm9314.h
@@ -21,7 +21,7 @@
#ifndef NLD_DM9314_H_
#define NLD_DM9314_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_9314(name, cEQ, cMRQ, cS0Q, cS1Q, cS2Q, cS3Q, cD0, cD1, cD2, cD3) \
NET_REGISTER_DEV(TTL_9314, name) \
diff --git a/src/lib/netlist/devices/nld_dm9334.cpp b/src/lib/netlist/devices/nld_dm9334.cpp
index c08ce53efed..8dceded5390 100644
--- a/src/lib/netlist/devices/nld_dm9334.cpp
+++ b/src/lib/netlist/devices/nld_dm9334.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_dm9334.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -143,8 +143,8 @@ namespace netlist
m_Q[i].push((q >> i) & 1, delay);
}
- NETLIB_DEVICE_IMPL(9334, "TTL_9334", "+CQ,+EQ,+D,+A0,+A1,+A2")
- NETLIB_DEVICE_IMPL(9334_dip, "TTL_9334_DIP", "")
+ NETLIB_DEVICE_IMPL(9334)
+ NETLIB_DEVICE_IMPL(9334_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_dm9334.h b/src/lib/netlist/devices/nld_dm9334.h
index e54208e3ba4..1a07e051333 100644
--- a/src/lib/netlist/devices/nld_dm9334.h
+++ b/src/lib/netlist/devices/nld_dm9334.h
@@ -65,7 +65,7 @@
#ifndef NLD_DM9334_H_
#define NLD_DM9334_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_9334(name, cCQ, cEQ, cD, cA0, cA1, cA2) \
NET_REGISTER_DEV(TTL_9334, name) \
diff --git a/src/lib/netlist/devices/nld_legacy.cpp b/src/lib/netlist/devices/nld_legacy.cpp
index 738230646e0..28fe0ad8188 100644
--- a/src/lib/netlist/devices/nld_legacy.cpp
+++ b/src/lib/netlist/devices/nld_legacy.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_legacy.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -25,7 +25,7 @@ namespace netlist
NETLIB_RESETI();
NETLIB_UPDATEI();
- private:
+ protected:
logic_input_t m_S;
logic_input_t m_R;
@@ -49,7 +49,7 @@ namespace netlist
NETLIB_RESETI();
NETLIB_UPDATEI();
- private:
+ protected:
logic_input_t m_I;
logic_output_t m_Q;
@@ -100,8 +100,8 @@ namespace netlist
m_last = nval;
}
- NETLIB_DEVICE_IMPL(nicRSFF, "NETDEV_RSFF", "")
- NETLIB_DEVICE_IMPL(nicDelay, "NETDEV_DELAY", "")
+ NETLIB_DEVICE_IMPL(nicRSFF)
+ NETLIB_DEVICE_IMPL(nicDelay)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_legacy.h b/src/lib/netlist/devices/nld_legacy.h
index aa3aec6f147..33f7d0caaf8 100644
--- a/src/lib/netlist/devices/nld_legacy.h
+++ b/src/lib/netlist/devices/nld_legacy.h
@@ -13,7 +13,7 @@
#ifndef NLD_LEGACY_H_
#define NLD_LEGACY_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
// ----------------------------------------------------------------------------------------
// Macros
diff --git a/src/lib/netlist/devices/nld_log.cpp b/src/lib/netlist/devices/nld_log.cpp
index 6b1b3d8efc1..29218aaa09a 100644
--- a/src/lib/netlist/devices/nld_log.cpp
+++ b/src/lib/netlist/devices/nld_log.cpp
@@ -5,10 +5,10 @@
*
*/
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
+#include "../plib/pstream.h"
+#include "../plib/pfmtlog.h"
#include "nld_log.h"
-#include "plib/pfmtlog.h"
-#include "plib/pstream.h"
//#include "sound/wavwrite.h"
namespace netlist
@@ -19,15 +19,15 @@ namespace netlist
{
NETLIB_CONSTRUCTOR(log)
, m_I(*this, "I")
- , m_strm(pstring(plib::pfmt("{1}.log")(this->name())))
- , m_writer(&m_strm)
+ , m_strm(plib::pfmt("{1}.log")(this->name()))
+ , m_writer(m_strm)
{
}
NETLIB_UPDATEI()
{
/* use pstring::sprintf, it is a LOT faster */
- m_writer.writeline(plib::pfmt("{1:.9} {2}").e(exec().time().as_double()).e(static_cast<double>(m_I())));
+ m_writer.writeline(plib::pfmt("{1:.9} {2}").e(netlist().time().as_double()).e(static_cast<double>(m_I())));
}
NETLIB_RESETI() { }
@@ -46,7 +46,7 @@ namespace netlist
NETLIB_UPDATEI()
{
- m_writer.writeline(plib::pfmt("{1:.9} {2}").e(exec().time().as_double()).e(static_cast<double>(m_I() - m_I2())));
+ m_writer.writeline(plib::pfmt("{1:.9} {2}").e(netlist().time().as_double()).e(static_cast<double>(m_I() - m_I2())));
}
NETLIB_RESETI() { }
@@ -89,8 +89,8 @@ namespace netlist
#endif
- NETLIB_DEVICE_IMPL(log, "LOG", "+I")
- NETLIB_DEVICE_IMPL(logD, "LOGD", "+I,+I2")
+ NETLIB_DEVICE_IMPL(log)
+ NETLIB_DEVICE_IMPL(logD)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_log.h b/src/lib/netlist/devices/nld_log.h
index 13c71ea7257..6364022cea2 100644
--- a/src/lib/netlist/devices/nld_log.h
+++ b/src/lib/netlist/devices/nld_log.h
@@ -18,10 +18,10 @@
#ifndef NLD_LOG_H_
#define NLD_LOG_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define LOG(name, cI) \
- NET_REGISTER_DEV(LOG, name) \
+ NET_REGISTER_DEV(??PG, name) \
NET_CONNECT(name, I, cI)
#define LOGD(name, cI, cI2) \
diff --git a/src/lib/netlist/devices/nld_mm5837.cpp b/src/lib/netlist/devices/nld_mm5837.cpp
index f6c2566bd43..e97ae41e437 100644
--- a/src/lib/netlist/devices/nld_mm5837.cpp
+++ b/src/lib/netlist/devices/nld_mm5837.cpp
@@ -6,8 +6,8 @@
*/
#include "nld_mm5837.h"
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/solver/nld_matrix_solver.h"
+#include "../solver/nld_matrix_solver.h"
+#include "../analog/nlid_twoterm.h"
#define R_LOW (1000.0)
#define R_HIGH (1000.0)
@@ -69,13 +69,13 @@ namespace netlist
{
//m_V0.initial(0.0);
//m_RV.do_reset();
- m_RV.set_G_V_I(plib::constants<nl_double>::one() / R_LOW, 0.0, 0.0);
+ m_RV.set(NL_FCONST(1.0) / R_LOW, 0.0, 0.0);
m_inc = netlist_time::from_double(1.0 / m_FREQ());
if (m_FREQ() < 24000 || m_FREQ() > 56000)
log().warning(MW_1_FREQUENCY_OUTSIDE_OF_SPECS_1, m_FREQ());
m_shift = 0x1ffff;
- m_is_timestep = m_RV.m_P.net().solver()->has_timestep_devices();
+ m_is_timestep = m_RV.m_P.net().solver()->is_timestep();
}
NETLIB_UPDATE_PARAM(MM5837_dip)
@@ -107,14 +107,14 @@ namespace netlist
// We only need to update the net first if this is a time stepping net
if (m_is_timestep)
- m_RV.update();
- m_RV.set_G_V_I(plib::constants<nl_double>::one() / R, V, plib::constants<nl_double>::zero());
- m_RV.solve_later(NLTIME_FROM_NS(1));
+ m_RV.update_dev();
+ m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
+ m_RV.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
}
}
- NETLIB_DEVICE_IMPL(MM5837_dip, "MM5837_DIP", "")
+ NETLIB_DEVICE_IMPL(MM5837_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_mm5837.h b/src/lib/netlist/devices/nld_mm5837.h
index 8f764aa651f..4af397d9965 100644
--- a/src/lib/netlist/devices/nld_mm5837.h
+++ b/src/lib/netlist/devices/nld_mm5837.h
@@ -19,7 +19,7 @@
#ifndef NLD_MM5837_H_
#define NLD_MM5837_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define MM5837_DIP(name) \
NET_REGISTER_DEV(MM5837_DIP, name)
diff --git a/src/lib/netlist/devices/nld_ne555.cpp b/src/lib/netlist/devices/nld_ne555.cpp
index 5e990d2e974..8795197bd57 100644
--- a/src/lib/netlist/devices/nld_ne555.cpp
+++ b/src/lib/netlist/devices/nld_ne555.cpp
@@ -46,8 +46,8 @@
*/
#include "nld_ne555.h"
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/solver/nld_solver.h"
+#include "../analog/nlid_twoterm.h"
+#include "../solver/nld_solver.h"
#define R_OFF (1E20)
#define R_ON (25) // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2
@@ -62,37 +62,31 @@ namespace netlist
, m_R1(*this, "R1")
, m_R2(*this, "R2")
, m_R3(*this, "R3")
- , m_ROUT(*this, "ROUT")
, m_RDIS(*this, "RDIS")
, m_RESET(*this, "RESET") // Pin 4
, m_THRES(*this, "THRESH") // Pin 6
, m_TRIG(*this, "TRIG") // Pin 2
- , m_OUT(*this, "_OUT") // to Pin 3 via ROUT
+ , m_OUT(*this, "OUT") // Pin 3
, m_last_out(*this, "m_last_out", false)
, m_ff(*this, "m_ff", false)
- , m_last_reset(*this, "m_last_reset", false)
{
register_subalias("GND", m_R3.m_N); // Pin 1
register_subalias("CONT", m_R1.m_N); // Pin 5
register_subalias("DISCH", m_RDIS.m_P); // Pin 7
register_subalias("VCC", m_R1.m_P); // Pin 8
- register_subalias("OUT", m_ROUT.m_P); // Pin 3
connect(m_R1.m_N, m_R2.m_P);
- connect(m_R1.m_N, m_R2.m_P);
connect(m_R2.m_N, m_R3.m_P);
connect(m_RDIS.m_N, m_R3.m_N);
- connect(m_OUT, m_ROUT.m_N);
}
NETLIB_UPDATEI();
NETLIB_RESETI();
- private:
+ protected:
analog::NETLIB_SUB(R_base) m_R1;
analog::NETLIB_SUB(R_base) m_R2;
analog::NETLIB_SUB(R_base) m_R3;
- analog::NETLIB_SUB(R_base) m_ROUT;
analog::NETLIB_SUB(R_base) m_RDIS;
logic_input_t m_RESET;
@@ -100,51 +94,52 @@ namespace netlist
analog_input_t m_TRIG;
analog_output_t m_OUT;
+ private:
state_var<bool> m_last_out;
state_var<bool> m_ff;
- state_var<bool> m_last_reset;
- nl_double clamp(const nl_double v, const nl_double a, const nl_double b)
- {
- nl_double ret = v;
- nl_double vcc = m_R1.m_P();
-
- if (ret > vcc - a)
- ret = vcc - a;
- if (ret < b)
- ret = b;
- return ret;
- }
+ inline nl_double clamp(const nl_double v, const nl_double a, const nl_double b);
+
};
NETLIB_OBJECT_DERIVED(NE555_dip, NE555)
{
NETLIB_CONSTRUCTOR_DERIVED(NE555_dip, NE555)
{
- register_subalias("1", "GND"); // Pin 1
- register_subalias("2", "TRIG"); // Pin 2
- register_subalias("3", "OUT"); // Pin 3
- register_subalias("4", "RESET"); // Pin 4
- register_subalias("5", "CONT"); // Pin 5
- register_subalias("6", "THRESH"); // Pin 6
- register_subalias("7", "DISCH"); // Pin 7
- register_subalias("8", "VCC"); // Pin 8
+ register_subalias("1", m_R3.m_N); // Pin 1
+ register_subalias("2", m_TRIG); // Pin 2
+ register_subalias("3", m_OUT); // Pin 3
+ register_subalias("4", m_RESET); // Pin 4
+ register_subalias("5", m_R1.m_N); // Pin 5
+ register_subalias("6", m_THRES); // Pin 6
+ register_subalias("7", m_RDIS.m_P); // Pin 7
+ register_subalias("8", m_R1.m_P); // Pin 8
}
};
+ inline nl_double NETLIB_NAME(NE555)::clamp(const nl_double v, const nl_double a, const nl_double b)
+ {
+ nl_double ret = v;
+ nl_double vcc = m_R1.m_P();
+
+ if (ret > vcc - a)
+ ret = vcc - a;
+ if (ret < b)
+ ret = b;
+ return ret;
+ }
+
NETLIB_RESET(NE555)
{
- m_R1.reset();
- m_R2.reset();
- m_R3.reset();
- m_ROUT.reset();
- m_RDIS.reset();
+ m_R1.do_reset();
+ m_R2.do_reset();
+ m_R3.do_reset();
+ m_RDIS.do_reset();
- /* FIXME make resistances a parameter, properly model other variants */
+ /* FIXME make resistance a parameter, properly model other variants */
m_R1.set_R(5000);
m_R2.set_R(5000);
m_R3.set_R(5000);
- m_ROUT.set_R(20);
m_RDIS.set_R(R_OFF);
m_last_out = true;
@@ -154,47 +149,39 @@ namespace netlist
{
// FIXME: assumes GND is connected to 0V.
- const auto reset = m_RESET();
+ nl_double vt = clamp(m_R2.m_P(), 0.7, 1.4);
+ bool bthresh = (m_THRES() > vt);
+ bool btrig = (m_TRIG() > clamp(m_R2.m_N(), 0.7, 1.4));
- if (!reset && m_last_reset)
+ if (!btrig)
{
- m_ff = false;
+ m_ff = true;
}
- else
+ else if (bthresh)
{
- const nl_double vt = clamp(m_R2.m_P(), 0.7, 1.4);
- const bool bthresh = (m_THRES() > vt);
- const bool btrig = (m_TRIG() > clamp(m_R2.m_N(), 0.7, 1.4));
-
- if (!btrig)
- m_ff = true;
- else if (bthresh)
- m_ff = false;
+ m_ff = false;
}
- const bool out = (!reset ? false : m_ff);
+ bool out = (!m_RESET() ? false : m_ff);
if (m_last_out && !out)
{
- m_RDIS.update();
+ m_RDIS.update_dev();
m_OUT.push(m_R3.m_N());
m_RDIS.set_R(R_ON);
}
else if (!m_last_out && out)
{
- m_RDIS.update();
+ m_RDIS.update_dev();
// FIXME: Should be delayed by 100ns
m_OUT.push(m_R1.m_P());
m_RDIS.set_R(R_OFF);
}
- m_last_reset = reset;
m_last_out = out;
}
- NETLIB_DEVICE_IMPL(NE555, "NE555", "")
- NETLIB_DEVICE_IMPL(NE555_dip, "NE555_DIP", "")
+ NETLIB_DEVICE_IMPL(NE555)
+ NETLIB_DEVICE_IMPL(NE555_dip)
- NETLIB_DEVICE_IMPL_ALIAS(MC1455P, NE555, "MC1455P", "")
- NETLIB_DEVICE_IMPL_ALIAS(MC1455P_dip, NE555_dip, "MC1455P_DIP", "")
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_ne555.h b/src/lib/netlist/devices/nld_ne555.h
index fc575d914b7..c629253f08f 100644
--- a/src/lib/netlist/devices/nld_ne555.h
+++ b/src/lib/netlist/devices/nld_ne555.h
@@ -4,7 +4,7 @@
#ifndef NLD_NE555_H_
#define NLD_NE555_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define NE555(name) \
NET_REGISTER_DEV(NE555, name)
@@ -12,10 +12,4 @@
#define NE555_DIP(name) \
NET_REGISTER_DEV(NE555_DIP, name)
-#define MC1455P(name) \
- NET_REGISTER_DEV(MC1455P, name)
-
-#define MC1455P_DIP(name) \
- NET_REGISTER_DEV(MC1455P_DIP, name)
-
#endif /* NLD_NE555_H_ */
diff --git a/src/lib/netlist/devices/nld_r2r_dac.cpp b/src/lib/netlist/devices/nld_r2r_dac.cpp
index 284b6673f76..4c29389d491 100644
--- a/src/lib/netlist/devices/nld_r2r_dac.cpp
+++ b/src/lib/netlist/devices/nld_r2r_dac.cpp
@@ -5,9 +5,9 @@
*
*/
-#include "netlist/nl_base.h"
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/nl_factory.h"
+#include "../nl_base.h"
+#include "../nl_factory.h"
+#include "../analog/nlid_twoterm.h"
namespace netlist
{
@@ -39,17 +39,17 @@ namespace netlist
NETLIB_UPDATE_PARAM(r2r_dac)
{
- solve_now();
+ update_dev();
double V = m_VIN() / static_cast<double>(1 << m_num())
* static_cast<double>(m_val());
- this->set_G_V_I(1.0 / m_R(), V, 0.0);
+ this->set(1.0 / m_R(), V, 0.0);
}
} //namespace analog
namespace devices {
- NETLIB_DEVICE_IMPL_NS(analog, r2r_dac, "R2R_DAC", "VIN,R,N")
- } // namespace devices
+ NETLIB_DEVICE_IMPL_NS(analog, r2r_dac)
+ }
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_r2r_dac.h b/src/lib/netlist/devices/nld_r2r_dac.h
index 8a4257a3cbf..18e5bddc053 100644
--- a/src/lib/netlist/devices/nld_r2r_dac.h
+++ b/src/lib/netlist/devices/nld_r2r_dac.h
@@ -46,7 +46,7 @@
#ifndef NLD_R2R_DAC_H_
#define NLD_R2R_DAC_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define R2R_DAC(name, p_VIN, p_R, p_N) \
NET_REGISTER_DEV(R2R_DAC, name) \
diff --git a/src/lib/netlist/devices/nld_schmitt.cpp b/src/lib/netlist/devices/nld_schmitt.cpp
index f219d215520..4bc41075f89 100644
--- a/src/lib/netlist/devices/nld_schmitt.cpp
+++ b/src/lib/netlist/devices/nld_schmitt.cpp
@@ -7,10 +7,10 @@
#include "nld_schmitt.h"
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/nl_base.h"
-#include "netlist/nl_errstr.h"
-#include "netlist/solver/nld_solver.h"
+#include "../nl_base.h"
+#include "../nl_errstr.h"
+#include "../analog/nlid_twoterm.h"
+#include "../solver/nld_solver.h"
#include <cmath>
@@ -82,11 +82,11 @@ namespace netlist
NETLIB_RESETI()
{
m_last_state = 1;
- m_RVI.reset();
- m_RVO.reset();
+ m_RVI.do_reset();
+ m_RVO.do_reset();
m_is_timestep = m_RVO.m_P.net().solver()->has_timestep_devices();
- m_RVI.set_G_V_I(plib::constants<nl_double>::one() / m_model.m_RI, m_model.m_VI, 0.0);
- m_RVO.set_G_V_I(plib::constants<nl_double>::one() / m_model.m_ROL, m_model.m_VOL, 0.0);
+ m_RVI.set(NL_FCONST(1.0) / m_model.m_RI, m_model.m_VI, 0.0);
+ m_RVO.set(NL_FCONST(1.0) / m_model.m_ROL, m_model.m_VOL, 0.0);
}
NETLIB_UPDATEI()
@@ -97,9 +97,9 @@ namespace netlist
{
m_last_state = 0;
if (m_is_timestep)
- m_RVO.update();
- m_RVO.set_G_V_I(plib::constants<nl_double>::one() / m_model.m_ROH, m_model.m_VOH, 0.0);
- m_RVO.solve_later();
+ m_RVO.update_dev();
+ m_RVO.set(NL_FCONST(1.0) / m_model.m_ROH, m_model.m_VOH, 0.0);
+ m_RVO.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
}
}
else
@@ -108,9 +108,9 @@ namespace netlist
{
m_last_state = 1;
if (m_is_timestep)
- m_RVO.update();
- m_RVO.set_G_V_I(plib::constants<nl_double>::one() / m_model.m_ROL, m_model.m_VOL, 0.0);
- m_RVO.solve_later();
+ m_RVO.update_dev();
+ m_RVO.set(NL_FCONST(1.0) / m_model.m_ROL, m_model.m_VOL, 0.0);
+ m_RVO.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
}
}
}
@@ -125,7 +125,7 @@ namespace netlist
bool m_is_timestep;
};
- NETLIB_DEVICE_IMPL(schmitt_trigger, "SCHMITT_TRIGGER", "MODEL")
+ NETLIB_DEVICE_IMPL(schmitt_trigger)
} // namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_schmitt.h b/src/lib/netlist/devices/nld_schmitt.h
index 20666b29cf7..ecce59be616 100644
--- a/src/lib/netlist/devices/nld_schmitt.h
+++ b/src/lib/netlist/devices/nld_schmitt.h
@@ -11,7 +11,7 @@
#define NLD_SCHMITT_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
// ----------------------------------------------------------------------------------------
// Macros
diff --git a/src/lib/netlist/devices/nld_system.cpp b/src/lib/netlist/devices/nld_system.cpp
index 03aa5c678f1..eabc4b4fbff 100644
--- a/src/lib/netlist/devices/nld_system.cpp
+++ b/src/lib/netlist/devices/nld_system.cpp
@@ -5,8 +5,8 @@
*
*/
-#include "netlist/solver/nld_solver.h"
-#include "netlist/solver/nld_matrix_solver.h"
+#include "../solver/nld_solver.h"
+#include "../solver/nld_matrix_solver.h"
#include "nlid_system.h"
namespace netlist
@@ -40,40 +40,54 @@ namespace netlist
{
m_cnt = 0;
m_off = netlist_time::from_double(m_offset());
- m_feedback.m_delegate = NETLIB_DELEGATE(extclock, update);
-
- //m_feedback.m_delegate .set(&NETLIB_NAME(extclock)::update, this);
//m_Q.initial(0);
}
- NETLIB_HANDLER(extclock, clk2)
+ NETLIB_UPDATE(extclock)
{
- m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt]);
+ m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt] + m_off);
+ m_off = netlist_time::zero();
if (++m_cnt >= m_size)
m_cnt = 0;
}
- NETLIB_HANDLER(extclock, clk2_pow2)
+ // ----------------------------------------------------------------------------------------
+ // logic_input
+ // ----------------------------------------------------------------------------------------
+
+ NETLIB_RESET(logic_input)
{
- m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt]);
- m_cnt = (++m_cnt) & (m_size-1);
+ m_Q.initial(0);
}
- NETLIB_UPDATE(extclock)
+ NETLIB_UPDATE(logic_input)
{
- m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt] + m_off);
- m_off = netlist_time::zero();
- if (++m_cnt >= m_size)
- m_cnt = 0;
+ m_Q.push(m_IN() & 1, netlist_time::from_nsec(1));
+ }
- // continue with optimized clock handlers ....
+ NETLIB_UPDATE_PARAM(logic_input)
+ {
+ }
+
+ // ----------------------------------------------------------------------------------------
+ // analog_input
+ // ----------------------------------------------------------------------------------------
- if ((m_size & (m_size-1)) == 0) // power of 2?
- m_feedback.m_delegate.set(&NETLIB_NAME(extclock)::clk2_pow2, this);
- else
- m_feedback.m_delegate.set(&NETLIB_NAME(extclock)::clk2, this);
+ NETLIB_RESET(analog_input)
+ {
+ m_Q.initial(0.0);
}
+ NETLIB_UPDATE(analog_input)
+ {
+ m_Q.push(m_IN());
+ }
+
+ NETLIB_UPDATE_PARAM(analog_input)
+ {
+ }
+
+
// -----------------------------------------------------------------------------
// nld_res_sw
// -----------------------------------------------------------------------------
@@ -92,10 +106,19 @@ namespace netlist
m_last_state = state;
const nl_double R = state ? m_RON() : m_ROFF();
- // FIXME: We only need to update the net first if this is a time stepping net
- m_R.update();
- m_R.set_R(R);
- m_R.solve_later();
+ // We only need to update the net first if this is a time stepping net
+ if ((0)) // m_R->m_P.net().as_analog().solver()->is_timestep())
+ {
+ m_R.update_dev();
+ m_R.set_R(R);
+ m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
+ }
+ else
+ {
+ m_R.set_R(R);
+ m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
+ //m_R->update_dev();
+ }
}
}
@@ -118,19 +141,17 @@ namespace netlist
}
- NETLIB_DEVICE_IMPL(dummy_input, "DUMMY_INPUT", "")
- NETLIB_DEVICE_IMPL(frontier, "FRONTIER_DEV", "+I,+G,+Q")
- NETLIB_DEVICE_IMPL(function, "AFUNC", "N,FUNC")
- NETLIB_DEVICE_IMPL(analog_input, "ANALOG_INPUT", "IN")
- NETLIB_DEVICE_IMPL(clock, "CLOCK", "FREQ")
- NETLIB_DEVICE_IMPL(extclock, "EXTCLOCK", "FREQ,PATTERN")
- NETLIB_DEVICE_IMPL(res_sw, "RES_SWITCH", "+IN,+P1,+P2")
- NETLIB_DEVICE_IMPL(mainclock, "MAINCLOCK", "FREQ")
- NETLIB_DEVICE_IMPL(gnd, "GND", "")
- NETLIB_DEVICE_IMPL(netlistparams, "PARAMETER", "")
-
- NETLIB_DEVICE_IMPL(logic_input, "LOGIC_INPUT", "IN,FAMILY")
- NETLIB_DEVICE_IMPL_ALIAS(logic_input_ttl, logic_input, "TTL_INPUT", "IN")
+ NETLIB_DEVICE_IMPL(dummy_input)
+ NETLIB_DEVICE_IMPL(frontier)
+ NETLIB_DEVICE_IMPL(function)
+ NETLIB_DEVICE_IMPL(logic_input)
+ NETLIB_DEVICE_IMPL(analog_input)
+ NETLIB_DEVICE_IMPL(clock)
+ NETLIB_DEVICE_IMPL(extclock)
+ NETLIB_DEVICE_IMPL(res_sw)
+ NETLIB_DEVICE_IMPL(mainclock)
+ NETLIB_DEVICE_IMPL(gnd)
+ NETLIB_DEVICE_IMPL(netlistparams)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_system.h b/src/lib/netlist/devices/nld_system.h
index 5158e098cfa..69a7c75dbf3 100644
--- a/src/lib/netlist/devices/nld_system.h
+++ b/src/lib/netlist/devices/nld_system.h
@@ -9,7 +9,7 @@
#ifndef NLD_SYSTEM_H_
#define NLD_SYSTEM_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
// -----------------------------------------------------------------------------
// Macros
diff --git a/src/lib/netlist/devices/nld_tms4800.cpp b/src/lib/netlist/devices/nld_tms4800.cpp
index 24729b10e72..29a9bd836ab 100644
--- a/src/lib/netlist/devices/nld_tms4800.cpp
+++ b/src/lib/netlist/devices/nld_tms4800.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_tms4800.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -39,9 +39,9 @@ namespace netlist
param_rom_t<uint8_t, 11, 8> m_ROM; // 16 Kbits, used as 2 Kbit x 8
};
- NETLIB_OBJECT_DERIVED(TMS4800_dip, TMS4800)
+ NETLIB_OBJECT_DERIVED(tms4800_dip, TMS4800)
{
- NETLIB_CONSTRUCTOR_DERIVED(TMS4800_dip, TMS4800)
+ NETLIB_CONSTRUCTOR_DERIVED(tms4800_dip, TMS4800)
{
register_subalias("2", m_A[0]);
register_subalias("3", m_A[1]);
@@ -97,8 +97,8 @@ namespace netlist
}
}
- NETLIB_DEVICE_IMPL(TMS4800, "ROM_TMS4800", "+AR,+OE1,+OE2,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10")
- NETLIB_DEVICE_IMPL(TMS4800_dip, "ROM_TMS4800_DIP", "")
+ NETLIB_DEVICE_IMPL(TMS4800)
+ NETLIB_DEVICE_IMPL(tms4800_dip)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_tms4800.h b/src/lib/netlist/devices/nld_tms4800.h
index c5bcd1337f0..dc72354cb03 100644
--- a/src/lib/netlist/devices/nld_tms4800.h
+++ b/src/lib/netlist/devices/nld_tms4800.h
@@ -28,7 +28,7 @@
#ifndef NLD_TMS4800_H_
#define NLD_TMS4800_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define ROM_TMS4800(name, cAR, cOE1, cOE2, cA0, cA1, cA2, cA3, cA4, cA5, cA6, cA7, cA8, cA9, cA10) \
NET_REGISTER_DEV(ROM_TMS4800, name) \
diff --git a/src/lib/netlist/devices/nld_tristate.cpp b/src/lib/netlist/devices/nld_tristate.cpp
index b05d09ea71e..74fbb206feb 100644
--- a/src/lib/netlist/devices/nld_tristate.cpp
+++ b/src/lib/netlist/devices/nld_tristate.cpp
@@ -6,7 +6,7 @@
*/
#include "nld_tristate.h"
-#include "netlist/nl_base.h"
+#include "../nl_base.h"
namespace netlist
{
@@ -70,8 +70,8 @@ namespace netlist
m_Q.push(q, NLTIME_FROM_NS(1));
}
- NETLIB_DEVICE_IMPL(tristate, "TTL_TRISTATE", "+CEQ1,+D1,+CEQ2,+D2")
- NETLIB_DEVICE_IMPL(tristate3, "TTL_TRISTATE3", "")
+ NETLIB_DEVICE_IMPL(tristate)
+ NETLIB_DEVICE_IMPL(tristate3)
} //namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_tristate.h b/src/lib/netlist/devices/nld_tristate.h
index 71f97d9812d..a5ff22fac96 100644
--- a/src/lib/netlist/devices/nld_tristate.h
+++ b/src/lib/netlist/devices/nld_tristate.h
@@ -10,7 +10,7 @@
#ifndef NLD_TRISTATE_H_
#define NLD_TRISTATE_H_
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
#define TTL_TRISTATE(name, cCEQ1, cD1, cCEQ2, cD2) \
NET_REGISTER_DEV(TTL_TRISTATE, name) \
diff --git a/src/lib/netlist/devices/nlid_cmos.h b/src/lib/netlist/devices/nlid_cmos.h
index d91d691453a..f9999aebcc0 100644
--- a/src/lib/netlist/devices/nlid_cmos.h
+++ b/src/lib/netlist/devices/nlid_cmos.h
@@ -8,8 +8,8 @@
#ifndef NLID_CMOS_H_
#define NLID_CMOS_H_
-#include "netlist/nl_base.h"
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
+#include "../nl_base.h"
namespace netlist
{
diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp
index a2fd18e85a7..4c3ec6f67aa 100644
--- a/src/lib/netlist/devices/nlid_proxy.cpp
+++ b/src/lib/netlist/devices/nlid_proxy.cpp
@@ -6,7 +6,7 @@
*/
#include "nlid_proxy.h"
-#include "netlist/solver/nld_solver.h"
+#include "../solver/nld_solver.h"
//#include "plib/pstream.h"
//#include "plib/pfmtlog.h"
//#include "nld_log.h"
@@ -20,7 +20,7 @@ namespace netlist
// nld_base_proxy
// -----------------------------------------------------------------------------
- nld_base_proxy::nld_base_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_proxy::nld_base_proxy(netlist_t &anetlist, const pstring &name,
logic_t *inout_proxied, detail::core_terminal_t *proxy_inout)
: device_t(anetlist, name)
{
@@ -29,23 +29,33 @@ namespace netlist
m_proxy_term = proxy_inout;
}
+ nld_base_proxy::~nld_base_proxy()
+ {
+ }
+
// ----------------------------------------------------------------------------------------
// nld_a_to_d_proxy
// ----------------------------------------------------------------------------------------
- nld_base_a_to_d_proxy::nld_base_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_a_to_d_proxy::nld_base_a_to_d_proxy(netlist_t &anetlist, const pstring &name,
logic_input_t *in_proxied, detail::core_terminal_t *in_proxy)
: nld_base_proxy(anetlist, name, in_proxied, in_proxy)
, m_Q(*this, "Q")
{
}
- nld_a_to_d_proxy::nld_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *in_proxied)
+ nld_base_a_to_d_proxy::~nld_base_a_to_d_proxy() {}
+
+ nld_a_to_d_proxy::nld_a_to_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *in_proxied)
: nld_base_a_to_d_proxy(anetlist, name, in_proxied, &m_I)
, m_I(*this, "I")
{
}
+ nld_a_to_d_proxy::~nld_a_to_d_proxy()
+ {
+ }
+
NETLIB_RESET(a_to_d_proxy)
{
}
@@ -71,32 +81,39 @@ namespace netlist
// nld_d_to_a_proxy
// ----------------------------------------------------------------------------------------
- nld_base_d_to_a_proxy::nld_base_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_d_to_a_proxy::nld_base_d_to_a_proxy(netlist_t &anetlist, const pstring &name,
logic_output_t *out_proxied, detail::core_terminal_t &proxy_out)
: nld_base_proxy(anetlist, name, out_proxied, &proxy_out)
, m_I(*this, "I")
{
}
- nld_d_to_a_proxy::nld_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *out_proxied)
+ nld_base_d_to_a_proxy::~nld_base_d_to_a_proxy()
+ {
+ }
+
+ nld_d_to_a_proxy::nld_d_to_a_proxy(netlist_t &anetlist, const pstring &name, logic_output_t *out_proxied)
: nld_base_d_to_a_proxy(anetlist, name, out_proxied, m_RV.m_P)
, m_GNDHack(*this, "_Q")
, m_RV(*this, "RV")
, m_last_state(*this, "m_last_var", -1)
, m_is_timestep(false)
{
- const std::vector<std::pair<pstring, pstring>> power_syms = { {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}};
+ const pstring power_syms[3][2] ={ {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}};
+ //register_sub(m_RV);
+ //register_term("1", m_RV.m_P);
+ //register_term("2", m_RV.m_N);
register_subalias("Q", m_RV.m_P);
connect(m_RV.m_N, m_GNDHack);
bool f = false;
- for (auto & pwr_sym : power_syms)
+ for (int i = 0; i < 3; i++)
{
pstring devname = out_proxied->device().name();
- auto tp = setup().find_terminal(devname + "." + pwr_sym.first,
+ auto tp = netlist().setup().find_terminal(devname + "." + power_syms[i][0],
detail::terminal_type::INPUT, false);
- auto tn = setup().find_terminal(devname + "." + pwr_sym.second,
+ auto tn = netlist().setup().find_terminal(devname + "." + power_syms[i][1],
detail::terminal_type::INPUT, false);
if (tp != nullptr && tn != nullptr)
{
@@ -109,6 +126,11 @@ namespace netlist
log().warning(MW_1_NO_POWER_TERMINALS_ON_DEVICE_1, out_proxied->device().name());
else
log().verbose("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name());
+#if (0)
+ printf("%s %s\n", out_proxied->name().c_str(), out_proxied->device().name().c_str());
+ auto x = netlist().setup().find_terminal(out_proxied->name(), detail::device_object_t::terminal_type::OUTPUT, false);
+ if (x) printf("==> %s\n", x->name().c_str());
+#endif
}
@@ -120,15 +142,15 @@ namespace netlist
//m_Q.initial(0.0);
m_last_state = -1;
- m_RV.reset();
+ m_RV.do_reset();
m_is_timestep = m_RV.m_P.net().solver()->has_timestep_devices();
- m_RV.set_G_V_I(plib::constants<nl_double>::one() / logic_family()->R_low(),
+ m_RV.set(NL_FCONST(1.0) / logic_family()->R_low(),
logic_family()->low_V(0.0, supply_V), 0.0);
}
NETLIB_UPDATE(d_to_a_proxy)
{
- const auto state = static_cast<int>(m_I());
+ const int state = static_cast<int>(m_I());
if (state != m_last_state)
{
// FIXME: Variable voltage
@@ -141,10 +163,10 @@ namespace netlist
// We only need to update the net first if this is a time stepping net
if (m_is_timestep)
{
- m_RV.update();
+ m_RV.update_dev();
}
- m_RV.set_G_V_I(plib::constants<nl_double>::one() / R, V, 0.0);
- m_RV.solve_later();
+ m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
+ m_RV.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
}
}
diff --git a/src/lib/netlist/devices/nlid_proxy.h b/src/lib/netlist/devices/nlid_proxy.h
index 9543b8db234..821cfa56d9d 100644
--- a/src/lib/netlist/devices/nlid_proxy.h
+++ b/src/lib/netlist/devices/nlid_proxy.h
@@ -11,8 +11,8 @@
#ifndef NLID_PROXY_H_
#define NLID_PROXY_H_
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/nl_setup.h"
+#include "../nl_setup.h"
+#include "../analog/nlid_twoterm.h"
namespace netlist
{
@@ -26,9 +26,11 @@ namespace netlist
NETLIB_OBJECT(base_proxy)
{
public:
- nld_base_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_proxy(netlist_t &anetlist, const pstring &name,
logic_t *inout_proxied, detail::core_terminal_t *proxy_inout);
+ virtual ~nld_base_proxy();
+
logic_t &term_proxied() const { return *m_term_proxied; }
detail::core_terminal_t &proxy_term() const { return *m_proxy_term; }
@@ -47,11 +49,13 @@ namespace netlist
{
public:
+ virtual ~nld_base_a_to_d_proxy();
+
virtual logic_output_t &out() { return m_Q; }
protected:
- nld_base_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_a_to_d_proxy(netlist_t &anetlist, const pstring &name,
logic_input_t *in_proxied, detail::core_terminal_t *in_proxy);
private:
@@ -63,7 +67,9 @@ namespace netlist
NETLIB_OBJECT_DERIVED(a_to_d_proxy, base_a_to_d_proxy)
{
public:
- nld_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *in_proxied);
+ nld_a_to_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *in_proxied);
+
+ virtual ~nld_a_to_d_proxy() override;
analog_input_t m_I;
@@ -82,20 +88,24 @@ namespace netlist
NETLIB_OBJECT_DERIVED(base_d_to_a_proxy, base_proxy)
{
public:
+ virtual ~nld_base_d_to_a_proxy();
virtual logic_input_t &in() { return m_I; }
protected:
- nld_base_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_d_to_a_proxy(netlist_t &anetlist, const pstring &name,
logic_output_t *out_proxied, detail::core_terminal_t &proxy_out);
logic_input_t m_I;
+
+ private:
};
NETLIB_OBJECT_DERIVED(d_to_a_proxy, base_d_to_a_proxy)
{
public:
- nld_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *out_proxied);
+ nld_d_to_a_proxy(netlist_t &anetlist, const pstring &name, logic_output_t *out_proxied);
+ virtual ~nld_d_to_a_proxy() override {}
protected:
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index f1f2af1b31e..326cd3dbf2c 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -11,10 +11,10 @@
#ifndef NLID_SYSTEM_H_
#define NLID_SYSTEM_H_
-#include "netlist/analog/nlid_twoterm.h"
-#include "netlist/nl_base.h"
-#include "netlist/nl_setup.h"
-#include "plib/putil.h"
+#include "../nl_base.h"
+#include "../nl_setup.h"
+#include "../analog/nlid_twoterm.h"
+#include "../plib/putil.h"
namespace netlist
{
@@ -27,8 +27,7 @@ namespace netlist
NETLIB_OBJECT(netlistparams)
{
NETLIB_CONSTRUCTOR(netlistparams)
- , m_use_deactivate(*this, "USE_DEACTIVATE", false)
- , m_startup_strategy(*this, "STARTUP_STRATEGY", 1)
+ , m_use_deactivate(*this, "USE_DEACTIVATE", 0)
{
}
NETLIB_UPDATEI() { }
@@ -36,7 +35,6 @@ namespace netlist
//NETLIB_UPDATE_PARAMI() { }
public:
param_logic_t m_use_deactivate;
- param_int_t m_startup_strategy;
};
// -----------------------------------------------------------------------------
@@ -54,7 +52,7 @@ namespace netlist
NETLIB_RESETI()
{
- m_Q.net().set_next_scheduled_time(netlist_time::zero());
+ m_Q.net().set_time(netlist_time::zero());
}
NETLIB_UPDATE_PARAMI()
@@ -67,14 +65,16 @@ namespace netlist
logic_net_t &net = m_Q.net();
// this is only called during setup ...
net.toggle_new_Q();
- net.set_next_scheduled_time(exec().time() + m_inc);
+ net.set_time(netlist().time() + m_inc);
}
public:
logic_output_t m_Q;
- netlist_time m_inc;
- private:
+
param_double_t m_freq;
+ netlist_time m_inc;
+
+ inline static void mc_update(logic_net_t &net);
};
// -----------------------------------------------------------------------------
@@ -96,7 +96,7 @@ namespace netlist
//NETLIB_RESETI();
NETLIB_UPDATE_PARAMI();
- private:
+ protected:
logic_input_t m_feedback;
logic_output_t m_Q;
@@ -127,35 +127,31 @@ namespace netlist
std::vector<pstring> pat(plib::psplit(m_pattern(),","));
m_off = netlist_time::from_double(m_offset());
- std::array<std::int64_t, 32> pati = { 0 };
-
+ unsigned long pati[32];
+ for (int pI = 0; pI < 32; pI++)
+ {
+ pati[pI] = 0;
+ }
m_size = static_cast<std::uint8_t>(pat.size());
- netlist_time::mult_type total = 0;
+ unsigned long total = 0;
for (unsigned i=0; i<m_size; i++)
{
- // FIXME: use pstonum_ne
- //pati[i] = plib::pstonum<decltype(pati[i])>(pat[i]);
- pati[i] = plib::pstonum<std::int64_t>(pat[i]);
+ pati[i] = static_cast<unsigned long>(pat[i].as_long());
total += pati[i];
}
netlist_time ttotal = netlist_time::zero();
- auto sm1 = static_cast<uint8_t>(m_size - 1);
- for (unsigned i=0; i < sm1; i++)
+ for (unsigned i=0; i<m_size - 1; i++)
{
m_inc[i] = base * pati[i];
ttotal += m_inc[i];
}
- m_inc[sm1] = base * total - ttotal;
+ m_inc[m_size - 1] = base * total - ttotal;
}
}
NETLIB_UPDATEI();
NETLIB_RESETI();
//NETLIB_UPDATE_PARAMI();
-
- NETLIB_HANDLERI(clk2);
- NETLIB_HANDLERI(clk2_pow2);
-
- private:
+ protected:
param_double_t m_freq;
param_str_t m_pattern;
@@ -166,7 +162,7 @@ namespace netlist
state_var_u8 m_cnt;
std::uint8_t m_size;
state_var<netlist_time> m_off;
- std::array<netlist_time, 32> m_inc;
+ netlist_time m_inc[32];
};
// -----------------------------------------------------------------------------
@@ -177,19 +173,20 @@ namespace netlist
{
NETLIB_CONSTRUCTOR(logic_input)
, m_Q(*this, "Q")
- , m_IN(*this, "IN", false)
+ , m_IN(*this, "IN", 0)
/* make sure we get the family first */
, m_FAMILY(*this, "FAMILY", "FAMILY(TYPE=TTL)")
{
set_logic_family(setup().family_from_model(m_FAMILY()));
- m_Q.set_logic_family(this->logic_family());
}
- NETLIB_UPDATEI() { }
- NETLIB_RESETI() { m_Q.initial(0); }
- NETLIB_UPDATE_PARAMI() { m_Q.push(m_IN() & 1, netlist_time::from_nsec(1)); }
+ NETLIB_UPDATE_AFTER_PARAM_CHANGE()
- private:
+ NETLIB_UPDATEI();
+ NETLIB_RESETI();
+ NETLIB_UPDATE_PARAMI();
+
+ protected:
logic_output_t m_Q;
param_logic_t m_IN;
@@ -203,12 +200,12 @@ namespace netlist
, m_IN(*this, "IN", 0.0)
{
}
+ NETLIB_UPDATE_AFTER_PARAM_CHANGE()
- NETLIB_UPDATEI() { }
- NETLIB_RESETI() { m_Q.initial(0.0); }
- NETLIB_UPDATE_PARAMI() { m_Q.push(m_IN()); }
-
- private:
+ NETLIB_UPDATEI();
+ NETLIB_RESETI();
+ NETLIB_UPDATE_PARAMI();
+ protected:
analog_output_t m_Q;
param_double_t m_IN;
};
@@ -281,8 +278,8 @@ namespace netlist
NETLIB_RESETI()
{
- m_RIN.set_G_V_I(1.0 / m_p_RIN(),0,0);
- m_ROUT.set_G_V_I(1.0 / m_p_ROUT(),0,0);
+ m_RIN.set(1.0 / m_p_RIN(),0,0);
+ m_ROUT.set(1.0 / m_p_ROUT(),0,0);
}
NETLIB_UPDATEI()
@@ -313,13 +310,13 @@ namespace netlist
, m_N(*this, "N", 1)
, m_func(*this, "FUNC", "A0")
, m_Q(*this, "Q")
- , m_compiled(this->name() + ".FUNCC", this, this->state().run_state_manager())
+ , m_compiled(this->name() + ".FUNCC", this, this->netlist().state())
{
std::vector<pstring> inps;
for (int i=0; i < m_N(); i++)
{
pstring n = plib::pfmt("A{1}")(i);
- m_I.push_back(pool().make_poolptr<analog_input_t>(*this, n));
+ m_I.push_back(plib::make_unique<analog_input_t>(*this, n));
inps.push_back(n);
m_vals.push_back(0.0);
}
@@ -336,7 +333,7 @@ namespace netlist
param_int_t m_N;
param_str_t m_func;
analog_output_t m_Q;
- std::vector<pool_owned_ptr<analog_input_t>> m_I;
+ std::vector<std::unique_ptr<analog_input_t>> m_I;
std::vector<double> m_vals;
plib::pfunction m_compiled;
@@ -360,17 +357,16 @@ namespace netlist
register_subalias("2", m_R.m_N);
}
- NETLIB_RESETI();
- //NETLIB_UPDATE_PARAMI();
- NETLIB_UPDATEI();
-
analog::NETLIB_SUB(R_base) m_R;
logic_input_t m_I;
param_double_t m_RON;
param_double_t m_ROFF;
- private:
+ NETLIB_RESETI();
+ //NETLIB_UPDATE_PARAMI();
+ NETLIB_UPDATEI();
+ private:
state_var<netlist_sig_t> m_last_state;
};
diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp
index 2221d855880..bf7d03fe3d7 100644
--- a/src/lib/netlist/devices/nlid_truthtable.cpp
+++ b/src/lib/netlist/devices/nlid_truthtable.cpp
@@ -6,9 +6,9 @@
*/
#include "nlid_truthtable.h"
-#include "netlist/nl_setup.h"
-#include "plib/palloc.h"
-#include "plib/plists.h"
+#include "../plib/plists.h"
+#include "../nl_setup.h"
+#include "../plib/palloc.h"
#include <bitset>
@@ -24,7 +24,7 @@ namespace netlist
template <typename T>
struct sbitset
{
- using type = T;
+ typedef T type;
sbitset() : m_bs(0) { }
/* explicit */ sbitset(T v) : m_bs(v) { }
@@ -77,8 +77,8 @@ namespace netlist
return ret;
}
- static constexpr const sbitset all_bits() noexcept { return sbitset(~static_cast<T>(0)); }
- static constexpr const sbitset no_bits() noexcept{ return sbitset(static_cast<T>(0)); }
+ static constexpr sbitset all_bits() { return sbitset(~static_cast<T>(0)); }
+ static constexpr sbitset no_bits() { return sbitset(static_cast<T>(0)); }
private:
T m_bs;
};
@@ -122,18 +122,8 @@ namespace netlist
}
}
- uint_least64_t mask() const
- {
- switch (m_size)
- {
- case 8: return static_cast<uint_least8_t>(-1);
- case 16: return static_cast<uint_least16_t>(-1);
- case 32: return static_cast<uint_least32_t>(-1);
- case 64: return static_cast<uint_least64_t>(-1);
- default:
- return 0; //should never happen
- }
- }
+ uint_least64_t mask() const { return static_cast<uint_least64_t>(-1); }
+
private:
void *m_data;
size_t m_size;
@@ -144,7 +134,7 @@ namespace netlist
truthtable_parser(unsigned NO, unsigned NI, bool *initialized,
packed_int outs, uint_least8_t *timing, netlist_time *timing_nt)
: m_NO(NO), m_NI(NI), m_initialized(initialized),
- m_out_state(outs), m_timing(timing), m_timing_nt(timing_nt),
+ m_outs(outs), m_timing(timing), m_timing_nt(timing_nt),
m_num_bits(m_NI),
m_size(1 << (m_num_bits))
{
@@ -161,7 +151,7 @@ namespace netlist
unsigned m_NO;
unsigned m_NI;
bool *m_initialized;
- packed_int m_out_state;
+ packed_int m_outs;
uint_least8_t *m_timing;
netlist_time *m_timing_nt;
@@ -188,27 +178,51 @@ namespace netlist
nl_assert_always(io.size() == 2, "too many '|'");
std::vector<pstring> inout(plib::psplit(io[0], ","));
nl_assert_always(inout.size() == m_num_bits, "bitcount wrong");
- std::vector<pstring> outputs(plib::psplit(io[1], ","));
- nl_assert_always(outputs.size() == m_NO, "output count wrong");
+ std::vector<pstring> out(plib::psplit(io[1], ","));
+ nl_assert_always(out.size() == m_NO, "output count wrong");
for (std::size_t i=0; i < m_NI; i++)
{
- inout[i] = plib::trim(inout[i]);
+ inout[i] = inout[i].trim();
m_I.emplace(i, *this, inout[i]);
}
for (std::size_t i=0; i < m_NO; i++)
{
- outputs[i] = plib::trim(outputs[i]);
- m_Q.emplace(i, *this, outputs[i]);
- // Connect output "Q" to input "_Q" if this exists
- // This enables timed state without having explicit state ....
- pstring tmp = "_" + outputs[i];
+ out[i] = out[i].trim();
+ m_Q.emplace(i, *this, out[i]);
+ }
+ // Connect output "Q" to input "_Q" if this exists
+ // This enables timed state without having explicit state ....
+ tt_bitset disabled_ignore = 0;
+ for (std::size_t i=0; i < m_NO; i++)
+ {
+ pstring tmp = "_" + out[i];
const std::size_t idx = plib::container::indexof(inout, tmp);
if (idx != plib::container::npos)
+ {
connect(m_Q[i], m_I[idx]);
+ // disable ignore for theses inputs altogether.
+ // FIXME: This shouldn't be necessary
+ disabled_ignore.set(idx);
+ }
}
m_ign = 0;
+
+#if 0
+ for (size_t i=0; i<m_size; i++)
+ {
+ m_ttp.m_outs[i] &= ~(disabled_ignore << m_NO);
+ }
+#endif
+#if 0
+ printf("%s\n", name().c_str());
+ for (int j=0; j < m_size; j++)
+ printf("%05x %04x %04x %04x\n", j, m_ttp->m_outs[j] & ((1 << m_NO)-1),
+ m_ttp->m_outs[j] >> m_NO, m_ttp->m_timing[j * m_NO + 0]);
+ for (int k=0; m_ttp->m_timing_nt[k] != netlist_time::zero(); k++)
+ printf("%d %f\n", k, m_ttp->m_timing_nt[k].as_double() * 1000000.0);
+#endif
}
// ----------------------------------------------------------------------------------------
@@ -224,20 +238,15 @@ namespace netlist
: netlist_base_factory_truthtable_t(name, classname, def_param, sourcefile)
{ }
- pool_owned_ptr<device_t> Create(netlist_state_t &anetlist, const pstring &name) override
+ plib::owned_ptr<device_t> Create(netlist_t &anetlist, const pstring &name) override
{
- using tt_type = nld_truthtable_t<m_NI, m_NO>;
+ typedef nld_truthtable_t<m_NI, m_NO> tt_type;
truthtable_parser desc_s(m_NO, m_NI, &m_ttbl.m_initialized,
- packed_int(m_ttbl.m_out_state.data(), sizeof(m_ttbl.m_out_state[0]) * 8),
- m_ttbl.m_timing_index.data(), m_ttbl.m_timing_nt.data());
+ packed_int(m_ttbl.m_outs, sizeof(m_ttbl.m_outs[0]) * 8),
+ m_ttbl.m_timing, m_ttbl.m_timing_nt);
desc_s.parse(m_desc);
-
- /* update truthtable family definitions */
- if (m_family_name != "")
- m_family_desc = anetlist.setup().family_from_model(m_family_name);
-
- return pool().make_poolptr<tt_type>(anetlist, name, m_family_desc, m_ttbl, m_desc);
+ return plib::owned_ptr<device_t>::Create<tt_type>(anetlist, name, m_family, m_ttbl, m_desc);
}
private:
typename nld_truthtable_t<m_NI, m_NO>::truthtable_t m_ttbl;
@@ -250,7 +259,7 @@ namespace netlist
for (std::size_t j=0; j<m_NI; j++)
{
// if changing the input directly doesn't change outputs we can ignore
- if (m_out_state[state] == m_out_state[tt_bitset(state).set(j)])
+ if (m_outs[state] == m_outs[tt_bitset(state).set(j)])
ignore.set(j);
}
@@ -276,7 +285,7 @@ namespace netlist
{
tt_bitset b = tign.expand_and(k);
// will any of the inputs ignored change the output if changed?
- if (m_out_state[state] != m_out_state[(state & tign.invert()) | b])
+ if (m_outs[state] != m_outs[(state & tign.invert()) | b])
{
t[j] = true;
break;
@@ -309,21 +318,21 @@ namespace netlist
void truthtable_parser::parseline(unsigned cur, std::vector<pstring> list,
tt_bitset state, uint_least64_t val, std::vector<uint_least8_t> &timing_index)
{
- pstring elem = plib::trim(list[cur]);
+ pstring elem = list[cur].trim();
uint_least64_t start = 0;
uint_least64_t end = 0;
- if (elem == "0")
+ if (elem.equals("0"))
{
start = 0;
end = 0;
}
- else if (elem == "1")
+ else if (elem.equals("1"))
{
start = 1;
end = 1;
}
- else if (elem == "X")
+ else if (elem.equals("X"))
{
start = 0;
end = 1;
@@ -343,10 +352,10 @@ void truthtable_parser::parseline(unsigned cur, std::vector<pstring> list,
else
{
// cutoff previous inputs and outputs for ignore
- if (m_out_state[nstate] != m_out_state.mask() && m_out_state[nstate] != val)
- throw nl_exception(plib::pfmt("Error in truthtable: State {1:04} already set, {2} != {3}\n")
- .x(nstate.as_uint())(m_out_state[nstate])(val) );
- m_out_state.set(nstate, val);
+ if (m_outs[nstate] != m_outs.mask() && m_outs[nstate] != val)
+ nl_exception(plib::pfmt("Error in truthtable: State {1:04} already set, {2} != {3}\n")
+ .x(nstate.as_uint())(m_outs[nstate])(val) );
+ m_outs.set(nstate, val);
for (std::size_t j=0; j<m_NO; j++)
m_timing[nstate * m_NO + j] = timing_index[j];
}
@@ -366,12 +375,12 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
line++;
for (unsigned j=0; j < m_size; j++)
- m_out_state.set(j, tt_bitset::all_bits());
+ m_outs.set(j, tt_bitset::all_bits());
for (int j=0; j < 16; j++)
m_timing_nt[j] = netlist_time::zero();
- while (!(ttline == ""))
+ while (!ttline.equals(""))
{
std::vector<pstring> io(plib::psplit(ttline,"|"));
// checks
@@ -393,13 +402,12 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
*/
for (unsigned j=0; j<m_NO; j++)
{
- pstring outs = plib::trim(out[j]);
- if (outs == "1")
+ pstring outs = out[j].trim();
+ if (outs.equals("1"))
val.set(j);
else
- nl_assert_always(outs == "0", "Unknown value (not 0 or 1");
- // FIXME: error handling
- netlist_time t = netlist_time::from_nsec(plib::pstonum<std::int64_t>(plib::trim(times[j])));
+ nl_assert_always(outs.equals("0"), "Unknown value (not 0 or 1");
+ netlist_time t = netlist_time::from_nsec(static_cast<unsigned long>(times[j].trim().as_long()));
uint_least8_t k=0;
while (m_timing_nt[k] != netlist_time::zero() && m_timing_nt[k] != t)
k++;
@@ -442,9 +450,9 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
}
for (size_t i=0; i<m_size; i++)
{
- if (m_out_state[i] == m_out_state.mask())
+ if (m_outs[i] == m_outs.mask())
throw nl_exception(plib::pfmt("truthtable: found element not set {1}\n").x(i) );
- m_out_state.set(i, m_out_state[i] | (ign[i] << m_NO));
+ m_outs.set(i, m_outs[i] | (ign[i] << m_NO));;
}
*m_initialized = true;
@@ -452,21 +460,26 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
netlist_base_factory_truthtable_t::netlist_base_factory_truthtable_t(const pstring &name, const pstring &classname,
const pstring &def_param, const pstring &sourcefile)
-: factory::element_t(name, classname, def_param, sourcefile), m_family_desc(family_TTL())
+: factory::element_t(name, classname, def_param, sourcefile), m_family(family_TTL())
+{
+}
+
+netlist_base_factory_truthtable_t::~netlist_base_factory_truthtable_t()
{
}
+
#define ENTRYY(n, m, s) case (n * 100 + m): \
{ using xtype = netlist_factory_truthtable_t<n, m>; \
- ret = plib::make_unique<xtype>(desc.name, desc.classname, desc.def_param, s); } break
+ ret = plib::palloc<xtype>(desc.name, desc.classname, desc.def_param, s); } break
#define ENTRY(n, s) ENTRYY(n, 1, s); ENTRYY(n, 2, s); ENTRYY(n, 3, s); \
ENTRYY(n, 4, s); ENTRYY(n, 5, s); ENTRYY(n, 6, s); \
ENTRYY(n, 7, s); ENTRYY(n, 8, s)
-plib::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile)
+void tt_factory_create(setup_t &setup, tt_desc &desc, const pstring &sourcefile)
{
- plib::unique_ptr<netlist_base_factory_truthtable_t> ret;
+ netlist_base_factory_truthtable_t *ret;
switch (desc.ni * 100 + desc.no)
{
@@ -487,9 +500,9 @@ plib::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &d
nl_assert_always(false, msg);
}
ret->m_desc = desc.desc;
- ret->m_family_name = desc.family;
-
- return ret;
+ if (desc.family != "")
+ ret->m_family = setup.family_from_model(desc.family);
+ setup.factory().register_device(std::unique_ptr<netlist_base_factory_truthtable_t>(ret));
}
} //namespace devices
diff --git a/src/lib/netlist/devices/nlid_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h
index 1217d7ee873..311f5ebd8ca 100644
--- a/src/lib/netlist/devices/nlid_truthtable.h
+++ b/src/lib/netlist/devices/nlid_truthtable.h
@@ -10,9 +10,9 @@
#ifndef NLID_TRUTHTABLE_H_
#define NLID_TRUTHTABLE_H_
-#include "netlist/nl_base.h"
-#include "netlist/nl_setup.h"
-#include "plib/putil.h"
+#include "../nl_setup.h"
+#include "../nl_base.h"
+#include "../plib/putil.h"
#define NETLIB_TRUTHTABLE(cname, nIN, nOUT) \
class NETLIB_NAME(cname) : public nld_truthtable_t<nIN, nOUT> \
@@ -29,9 +29,17 @@
namespace netlist
{
-namespace devices
-{
+ namespace devices
+ {
+#if 0
+ template<unsigned bits> struct uint_for_size { typedef uint_least32_t type; };
+ template<unsigned bits>
+ struct need_bytes_for_bits
+ {
+ enum { value = 4 };
+ };
+#else
template<unsigned bits>
struct need_bytes_for_bits
{
@@ -44,35 +52,11 @@ namespace devices
};
template<unsigned bits> struct uint_for_size;
- template<> struct uint_for_size<1> { using type = uint_least8_t; };
- template<> struct uint_for_size<2> { using type = uint_least16_t; };
- template<> struct uint_for_size<4> { using type = uint_least32_t; };
- template<> struct uint_for_size<8> { using type = uint_least64_t; };
-
- template<std::size_t NUM, typename R>
- struct aa
- {
- template<typename T>
- R f(T &arr, const R ign)
- {
- R r = aa<NUM-1, R>().f(arr, ign);
- if (ign & (1 << (NUM-1)))
- arr[NUM-1].activate();
- return r | (arr[NUM-1]() << (NUM-1));
- }
- };
-
- template<typename R>
- struct aa<1, R>
- {
- template<typename T>
- R f(T &arr, const R ign)
- {
- if ((ign & 1))
- arr[0].activate();
- return arr[0]();
- }
- };
+ template<> struct uint_for_size<1> { typedef uint_least8_t type; };
+ template<> struct uint_for_size<2> { typedef uint_least16_t type; };
+ template<> struct uint_for_size<4> { typedef uint_least32_t type; };
+ template<> struct uint_for_size<8> { typedef uint_least64_t type; };
+#endif
template<std::size_t m_NI, std::size_t m_NO>
NETLIB_OBJECT(truthtable_t)
@@ -81,23 +65,22 @@ namespace devices
detail::family_setter_t m_fam;
public:
- using type_t = typename uint_for_size<need_bytes_for_bits<m_NO + m_NI>::value>::type;
+ typedef typename uint_for_size<need_bytes_for_bits<m_NO + m_NI>::value>::type type_t;
static constexpr const std::size_t m_num_bits = m_NI;
static constexpr const std::size_t m_size = (1 << (m_num_bits));
static constexpr const type_t m_outmask = ((1 << m_NO) - 1);
+ static constexpr const std::size_t m_min_devices_for_deactivate = 2;
struct truthtable_t
{
truthtable_t()
- : m_timing_index{0}
- , m_initialized(false)
+ : m_initialized(false)
{}
-
- std::array<type_t, m_size> m_out_state;
- std::array<uint_least8_t, m_size * m_NO> m_timing_index;
- std::array<netlist_time, 16> m_timing_nt;
bool m_initialized;
+ type_t m_outs[m_size];
+ uint_least8_t m_timing[m_size * m_NO];
+ netlist_time m_timing_nt[16];
};
template <class C>
@@ -107,6 +90,7 @@ namespace devices
: device_t(owner, name)
, m_fam(*this, fam)
, m_ign(*this, "m_ign", 0)
+ , m_active(*this, "m_active", 1)
, m_ttp(ttp)
{
init(desc);
@@ -116,14 +100,13 @@ namespace devices
NETLIB_RESETI()
{
- int active_outputs = 0;
+ m_active = 0;
m_ign = 0;
for (auto &i : m_I)
i.activate();
for (auto &q : m_Q)
if (q.has_net() && q.net().num_cons() > 0)
- active_outputs++;
- set_active_outputs(active_outputs);
+ m_active++;
}
NETLIB_UPDATEI()
@@ -133,14 +116,28 @@ namespace devices
void inc_active() NL_NOEXCEPT override
{
- process<false>();
+ if (m_NI >= m_min_devices_for_deactivate)
+ if (++m_active == 1)
+ {
+ process<false>();
+ }
}
void dec_active() NL_NOEXCEPT override
{
- for (std::size_t i = 0; i< m_NI; i++)
- m_I[i].inactivate();
- m_ign = (1<<m_NI)-1;
+ /* FIXME:
+ * Based on current measurements there is no point to disable
+ * 1 input devices. This should actually be a parameter so that we
+ * can decide for each individual gate whether it is beneficial to
+ * ignore deactivation.
+ */
+ if (m_NI >= m_min_devices_for_deactivate)
+ if (--m_active == 0)
+ {
+ for (std::size_t i = 0; i< m_NI; i++)
+ m_I[i].inactivate();
+ m_ign = (1<<m_NI)-1;
+ }
}
plib::uninitialised_array_t<logic_input_t, m_NI> m_I;
@@ -156,44 +153,46 @@ namespace devices
netlist_time mt(netlist_time::zero());
type_t nstate(0);
- type_t ign(m_ign);
-#if 1
- if (!doOUT)
- for (std::size_t i = 0; i < m_NI; i++)
- {
- m_I[i].activate();
- //nstate |= (m_I[i]() ? (1 << i) : 0);
- nstate |= (m_I[i]() << i);
- mt = std::max(this->m_I[i].net().next_scheduled_time(), mt);
- }
- else
- for (std::size_t i = 0; i < m_NI; i++)
- {
- if ((ign & 1))
- m_I[i].activate();
- //nstate |= (m_I[i]() ? (1 << i) : 0);
- nstate |= (m_I[i]() << i);
- ign >>= 1;
- }
-#else
- if (!doOUT)
+ if (m_NI >= m_min_devices_for_deactivate)
{
- nstate = aa<m_NI, type_t>().f(m_I, ~0);
- for (std::size_t i = 0; i < m_NI; i++)
- mt = std::max(this->m_I[i].net().time(), mt);
+ type_t ign(m_ign);
+ if (!doOUT)
+ for (std::size_t i = 0; i < m_NI; i++)
+ {
+ m_I[i].activate();
+ nstate |= (m_I[i]() ? (1 << i) : 0);
+ mt = std::max(this->m_I[i].net().time(), mt);
+ }
+ else
+ for (std::size_t i = 0; i < m_NI; i++)
+ {
+ if ((ign & 1))
+ m_I[i].activate();
+ nstate |= (m_I[i]() ? (1 << i) : 0);
+ ign >>= 1;
+ }
}
else
- nstate = aa<m_NI, type_t>().f(m_I, ign);
-#endif
+ {
+ if (!doOUT)
+ for (std::size_t i = 0; i < m_NI; i++)
+ {
+ nstate |= (m_I[i]() ? (1 << i) : 0);
+ mt = std::max(this->m_I[i].net().time(), mt);
+ }
+ else
+ for (std::size_t i = 0; i < m_NI; i++)
+ nstate |= (m_I[i]() ? (1 << i) : 0);
+ }
- const type_t outstate(m_ttp.m_out_state[nstate]);
+ const type_t outstate(m_ttp.m_outs[nstate]);
type_t out(outstate & m_outmask);
m_ign = outstate >> m_NO;
const std::size_t timebase(nstate * m_NO);
- const auto *t(&m_ttp.m_timing_index[timebase]);
- const auto *tim = m_ttp.m_timing_nt.data();
+ const auto *t(&m_ttp.m_timing[timebase]);
+ const auto *tim = m_ttp.m_timing_nt;
if (doOUT)
for (std::size_t i = 0; i < m_NO; out >>= 1, ++i)
@@ -202,14 +201,18 @@ namespace devices
for (std::size_t i = 0; i < m_NO; out >>= 1, ++i)
m_Q[i].set_Q_time(out & 1, mt + tim[t[i]]);
- ign = m_ign;
- for (auto I = m_I.begin(); ign != 0; ign >>= 1, ++I)
- if (ign & 1)
- I->inactivate();
+ if (m_NI >= m_min_devices_for_deactivate)
+ {
+ type_t ign(m_ign);
+ for (auto I = m_I.begin(); ign != 0; ign >>= 1, ++I)
+ if (ign & 1)
+ I->inactivate();
+ }
}
/* FIXME: check width */
state_var<type_t> m_ign;
+ state_var_s32 m_active;
const truthtable_t &m_ttp;
};
@@ -219,15 +222,15 @@ namespace devices
netlist_base_factory_truthtable_t(const pstring &name, const pstring &classname,
const pstring &def_param, const pstring &sourcefile);
+ virtual ~netlist_base_factory_truthtable_t();
+
std::vector<pstring> m_desc;
- pstring m_family_name;
- const logic_family_desc_t *m_family_desc;
+ const logic_family_desc_t *m_family;
};
- /* the returned element is still missing a pointer to the family ... */
- plib::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile);
+ void tt_factory_create(setup_t &setup, tt_desc &desc, const pstring &sourcefile);
-} //namespace devices
+ } //namespace devices
} // namespace netlist