diff options
author | 2020-08-19 19:33:13 -0700 | |
---|---|---|
committer | 2020-08-19 19:33:13 -0700 | |
commit | f7b263de20594fd720a8ff49b7528c48a64ddb9d (patch) | |
tree | abedd8ff2f40bac0e79a587b46d2b199dbe98fb8 /src/lib/netlist | |
parent | 92925532c301c9ac70c908ca84b6e30a11d3febf (diff) |
Sound and other improvements to Sega G-80 games. (#7103)
Sound and other improvements to Sega G-80 games: [Aaron Giles, couriersud]
* Added netlist-based sound to Eliminator, Zektor, Space Fury, and Astro Blaster.
* Split the Sega Universal Sound Board and Speech Boards into their own separate files.
* Improved Universal Sound Board implementation for better accuracy in Star Trek and Tac/Scan.
* Wrote netlist-based backend for Universal Sound Board; currently disabled due to limitations in the system.
* Wrote netlist-based backend for Speech Board; currently disabled pending future sound system changes.
* Implemented wait states and the vector DRAW flag to help improve timing.
SP0250 Improvements: [Aaron Giles]
* Matched clock divider to real chip measurements.
* Fixed behavior when not fed enough data; addresses "gapping" in speech in Sega games.
* Implemented accurate LFR noise generator according to real chip measurements.
* Added pulse-width modulation DAC output mode for future consumption by netlist.
Netlist additions: [Aaron Giles]
* Added compile-time option to record nltool-compatible CSV files.
* Improved CD4020 implementation.
* Fixed CD4053 behavior.
* Added 74139 device.
* Added TL082 device.
8253 PIT changes: [Aaron Giles]
* Added explicit synchronization to all writes.
* Cleaned up some timing calculations to avoid double<->attotime conversions.
Diffstat (limited to 'src/lib/netlist')
-rw-r--r-- | src/lib/netlist/devices/nld_4020.cpp | 20 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_4053.cpp | 70 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_devinc.h | 12 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_opamp_lib.cpp | 9 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_opamp_lib.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_ttl74xx_lib.cpp | 57 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_ttl74xx_lib.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/nl_errstr.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.cpp | 9 |
9 files changed, 140 insertions, 47 deletions
diff --git a/src/lib/netlist/devices/nld_4020.cpp b/src/lib/netlist/devices/nld_4020.cpp index 4143f66da8d..9e2dd386654 100644 --- a/src/lib/netlist/devices/nld_4020.cpp +++ b/src/lib/netlist/devices/nld_4020.cpp @@ -46,17 +46,15 @@ namespace netlist namespace devices { - template <unsigned _LiveBitmask> + template <unsigned _TotalBits, unsigned _LiveBitmask> NETLIB_OBJECT(CD4020_sub) { - static constexpr unsigned MAX_BITS = 14; - static constexpr unsigned MAX_BITMASK = (1 << MAX_BITS) - 1; + static_assert((_LiveBitmask >> _TotalBits) == 0, "Live bitmask too large"); NETLIB_CONSTRUCTOR_MODEL(CD4020_sub, "CD4XXX") , m_IP(*this, "IP", NETLIB_DELEGATE(ip)) , m_RESET(*this, "RESET", NETLIB_DELEGATE(reseti)) - , m_Q(*this, {"Q1", "_Q2", "_Q3", "Q4", "Q5", "Q6", "Q7", "Q8", "Q9", - "Q10", "Q11", "Q12", "Q13", "Q14"}) + , m_Q(*this, 1, "Q{}") , m_cnt(*this, "m_cnt", 0) , m_supply(*this) { @@ -81,7 +79,7 @@ namespace netlist m_cnt = 0; m_IP.inactivate(); /* static */ const netlist_time reset_time = netlist_time::from_nsec(140); - for (unsigned i = 0; i < MAX_BITS; i++) + for (int i = 0; i < _TotalBits; i++) if (((_LiveBitmask >> i) & 1) != 0) m_Q[i].push(0, reset_time); } @@ -102,13 +100,13 @@ namespace netlist NLTIME_FROM_NS(1380), NLTIME_FROM_NS(1480), }; - for (unsigned i = 0; i < MAX_BITS; i++) + for (int i = 0; i < _TotalBits; i++) if (((_LiveBitmask >> i) & 1) != 0) - m_Q[i].push(cnt & 1, out_delayQn[i]); + m_Q[i].push((cnt >> i) & 1, out_delayQn[i]); } logic_input_t m_IP; logic_input_t m_RESET; - object_array_t<logic_output_t, MAX_BITS> m_Q; + object_array_t<logic_output_t, _TotalBits> m_Q; state_var<unsigned> m_cnt; nld_power_pins m_supply; @@ -140,7 +138,7 @@ namespace netlist //NETLIB_RESETI() {} private: - NETLIB_SUB(CD4020_sub)<0x3ff9> m_sub; + NETLIB_SUB(CD4020_sub)<14, 0x3ff9> m_sub; }; NETLIB_OBJECT(CD4024) @@ -164,7 +162,7 @@ namespace netlist //NETLIB_RESETI() {} private: - NETLIB_SUB(CD4020_sub)<0x7f> m_sub; + NETLIB_SUB(CD4020_sub)<7, 0x7f> m_sub; }; diff --git a/src/lib/netlist/devices/nld_4053.cpp b/src/lib/netlist/devices/nld_4053.cpp index 62db781fbfa..5056b453622 100644 --- a/src/lib/netlist/devices/nld_4053.cpp +++ b/src/lib/netlist/devices/nld_4053.cpp @@ -48,19 +48,14 @@ namespace netlist , m_supply(*this) { connect(m_RX.N(), m_RY.N()); - register_subalias("X", m_RX.P()); register_subalias("Y", m_RY.P()); - register_subalias("XY", m_RX.N()); } NETLIB_RESETI() { - // Start in off condition - // FIXME: is ROFF correct? - m_RX.set_R(plib::reciprocal(exec().gmin())); - m_RY.set_R(plib::reciprocal(exec().gmin())); + update_state(true, false); } private: @@ -80,40 +75,16 @@ namespace netlist } if (newx != m_lastx || newy != m_lasty) - { - const nl_fptype sup = (m_supply.VCC().Q_Analog() - m_supply.GND().Q_Analog()); - const nl_fptype Ron = m_base_r() * nlconst::magic(5.0) / sup; - const nl_fptype Roff = plib::reciprocal(exec().gmin()); - const nl_fptype RX = (newx != 0) ? Ron : Roff; - const nl_fptype RY = (newy != 0) ? Ron : Roff; - if (m_RX.solver() == m_RY.solver()) - { - m_RX.change_state([this, &RX, &RY]() - { - m_RX.set_R(RX); - m_RY.set_R(RY); - }); - } - else - { - m_RX.change_state([this, &RX]() - { - m_RX.set_R(RX); - }); - m_RY.change_state([this, &RY]() - { - m_RY.set_R(RY); - }); - } - } + update_state(newx, newy); } bool on(analog_input_t &input, bool &state) { + // digital inputs are based on VDD nl_fptype sup = (m_supply.VCC().Q_Analog() - m_supply.GND().Q_Analog()); nl_fptype in = input() - m_supply.GND().Q_Analog(); - nl_fptype low = nlconst::magic(0.45) * sup; - nl_fptype high = nlconst::magic(0.55) * sup; + nl_fptype low = nlconst::magic(0.3) * sup; + nl_fptype high = nlconst::magic(0.7) * sup; if (in < low) { state = false; @@ -125,6 +96,37 @@ namespace netlist return state; } + void update_state(bool newx, bool newy) + { + // analog output is based on VEE + const nl_fptype sup = (m_VEE() - m_supply.GND().Q_Analog()); + const nl_fptype Ron = m_base_r() * nlconst::magic(5.0) / sup; + const nl_fptype Roff = plib::reciprocal(exec().gmin()); + const nl_fptype RX = newx ? Ron : Roff; + const nl_fptype RY = newy ? Ron : Roff; + if (m_RX.solver() == m_RY.solver()) + { + m_RX.change_state([this, &RX, &RY]() + { + m_RX.set_R(RX); + m_RY.set_R(RY); + }); + } + else + { + m_RX.change_state([this, &RX]() + { + m_RX.set_R(RX); + }); + m_RY.change_state([this, &RY]() + { + m_RY.set_R(RY); + }); + } + m_lastx = newx; + m_lasty = newy; + } + analog::NETLIB_SUB(R_base) m_RX; analog::NETLIB_SUB(R_base) m_RY; analog_input_t m_select; diff --git a/src/lib/netlist/devices/nld_devinc.h b/src/lib/netlist/devices/nld_devinc.h index 1a1e7d2865f..5780106c96b 100644 --- a/src/lib/netlist/devices/nld_devinc.h +++ b/src/lib/netlist/devices/nld_devinc.h @@ -1021,6 +1021,10 @@ #define TTL_74113A_DIP(...) \ NET_REGISTER_DEVEXT(TTL_74113A_DIP, __VA_ARGS__) +// usage : TTL_74139_GATE(name) +#define TTL_74139_GATE(...) \ + NET_REGISTER_DEVEXT(TTL_74139_GATE, __VA_ARGS__) + // usage : TTL_74155A_GATE(name) #define TTL_74155A_GATE(...) \ NET_REGISTER_DEVEXT(TTL_74155A_GATE, __VA_ARGS__) @@ -1202,6 +1206,10 @@ #define TTL_74126_DIP(...) \ NET_REGISTER_DEVEXT(TTL_74126_DIP, __VA_ARGS__) +// usage : TTL_74139_DIP(name) +#define TTL_74139_DIP(...) \ + NET_REGISTER_DEVEXT(TTL_74139_DIP, __VA_ARGS__) + // usage : TTL_74153_DIP(name) #define TTL_74153_DIP(...) \ NET_REGISTER_DEVEXT(TTL_74153_DIP, __VA_ARGS__) @@ -1387,6 +1395,10 @@ #define TL081_DIP(...) \ NET_REGISTER_DEVEXT(TL081_DIP, __VA_ARGS__) +// usage : TL082_DIP(name) +#define TL082_DIP(...) \ + NET_REGISTER_DEVEXT(TL082_DIP, __VA_ARGS__) + // usage : TL084_DIP(name) #define TL084_DIP(...) \ NET_REGISTER_DEVEXT(TL084_DIP, __VA_ARGS__) diff --git a/src/lib/netlist/macro/nlm_opamp_lib.cpp b/src/lib/netlist/macro/nlm_opamp_lib.cpp index a8fae82e8c8..94c5da23686 100644 --- a/src/lib/netlist/macro/nlm_opamp_lib.cpp +++ b/src/lib/netlist/macro/nlm_opamp_lib.cpp @@ -314,6 +314,14 @@ static NETLIST_START(TL081_DIP) NETLIST_END() +static NETLIST_START(TL082_DIP) + OPAMP(A, "TL084") + OPAMP(B, "TL084") + + INCLUDE(opamp_layout_2_8_4) + +NETLIST_END() + static NETLIST_START(TL084_DIP) OPAMP(A, "TL084") OPAMP(B, "TL084") @@ -594,6 +602,7 @@ NETLIST_START(opamp_lib) LOCAL_LIB_ENTRY(MB3614_DIP) LOCAL_LIB_ENTRY(MC3340_DIP) LOCAL_LIB_ENTRY(TL081_DIP) + LOCAL_LIB_ENTRY(TL082_DIP) LOCAL_LIB_ENTRY(TL084_DIP) LOCAL_LIB_ENTRY(LM324_DIP) LOCAL_LIB_ENTRY(LM358_DIP) diff --git a/src/lib/netlist/macro/nlm_opamp_lib.h b/src/lib/netlist/macro/nlm_opamp_lib.h index 7c9b31a29bd..362e5c7baa1 100644 --- a/src/lib/netlist/macro/nlm_opamp_lib.h +++ b/src/lib/netlist/macro/nlm_opamp_lib.h @@ -27,6 +27,9 @@ #define TL081_DIP(name) \ NET_REGISTER_DEV(TL081_DIP, name) +#define TL082_DIP(name) \ + NET_REGISTER_DEV(TL082_DIP, name) + #define TL084_DIP(name) \ NET_REGISTER_DEV(TL084_DIP, name) diff --git a/src/lib/netlist/macro/nlm_ttl74xx_lib.cpp b/src/lib/netlist/macro/nlm_ttl74xx_lib.cpp index 92f486aac5a..0d3754e94d7 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx_lib.cpp +++ b/src/lib/netlist/macro/nlm_ttl74xx_lib.cpp @@ -1822,6 +1822,52 @@ static NETLIST_START(TTL_74126_DIP) ) NETLIST_END() +//- Identifier: TTL_74139_DIP +//- Title: 54LS139/DM54LS139/DM74LS139 Decoders/Demultiplexers +//- Description: These Schottky-clamped circuits are designed to be used in high-performance memory-decoding or data-routing applications, requiring very short propagation delay times. +//- In high-performance memory systems these decoders can be used to minimize the effects of system decoding. +//- When used with high-speed memories, the delay times of these decoders are usually less than the typical access time of the memory. +//- This means that the effective system delay introduced by the decoder is negligible. +//- The LS139 comprises two separate two-line-to-four-line decoders in a single package. +//- The active-low enable input can be used as a data line in demultiplexing applications. +//- All of these decoders/demultiplexers feature fully buffered inputs, presenting only one normalized load to its driving circuit. +// All inputs are clamped with high-performance Schottky diodes to suppress line-ringing and simplify system design. +//- Pinalias: G1,A1,B1,1Y0,1Y1,1Y2,1Y3,GND,2Y3,2Y2,2Y1,2Y0,B2,A2,G2,VCC +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- FunctionTable: +//- pdf.datasheetcatalog.com/datasheets/166/375388_DS.pdf +//- +//- +---+-------+-------------+ +//- | E | A0 A1 | O0 O1 O2 O3 | +//- +===+=======+=============+ +//- | 1 | X X | 1 1 1 1 | +//- | 0 | 0 0 | 0 1 1 1 | +//- | 0 | 1 0 | 1 0 1 1 | +//- | 0 | 0 1 | 1 1 0 1 | +//- | 0 | 1 1 | 1 1 1 0 | +//- +---+-------+-------------+ +//- +static NETLIST_START(TTL_74139_DIP) + NET_REGISTER_DEV(TTL_74139_GATE, A) + NET_REGISTER_DEV(TTL_74139_GATE, B) + + NET_C(A.VCC, B.VCC) + NET_C(A.GND, B.GND) + + DIPPINS( /* +--------------+ */ + A.E, /* /Ea |1 ++ 16| VCC */ A.VCC, + A.A, /* A0a |2 15| /Eb */ B.E, + A.B, /* A1a |3 14| A0b */ B.A, + A.0, /* /O0a |4 74139 13| A1b */ B.B, + A.1, /* /O1a |5 12| /O0b */ B.0, + A.2, /* /O2a |6 11| /O1b */ B.1, + A.3, /* /O3a |7 10| /O2b */ B.2, + A.GND,/* GND |8 9| /O3b */ B.3 + /* +--------------+ */ + ) +NETLIST_END() + //- Identifier: TTL_74153_DIP //- Title: 54153/DM54153/DM74153 Dual 4-Line to 1-LineData Selectors/Multiplexers //- Description: Each of these data selectors/multiplexers contains inverters and drivers to supply fully complementary, on-chip, binary decoding data selection to the AND-OR-invert gates. @@ -3205,6 +3251,16 @@ NETLIST_START(ttl74xx_lib) TRUTHTABLE_END() + TRUTHTABLE_START(TTL_74139_GATE, 3, 4, "") + TT_HEAD("E,A,B|0,1,2,3") + TT_LINE("1,X,X|1,1,1,1|14") + TT_LINE("0,0,0|0,1,1,1|14") + TT_LINE("0,0,1|1,0,1,1|14") + TT_LINE("0,1,0|1,1,0,1|14") + TT_LINE("0,1,1|1,1,1,0|14") + TT_FAMILY("74XX") + TRUTHTABLE_END() + TRUTHTABLE_START(TTL_74155A_GATE, 4, 4, "") TT_HEAD("B,A,G,C|0,1,2,3") TT_LINE("X,X,1,X|1,1,1,1|13,13,13,13") @@ -3367,6 +3423,7 @@ NETLIST_START(ttl74xx_lib) LOCAL_LIB_ENTRY(TTL_9602_DIP) LOCAL_LIB_ENTRY(TTL_74125_DIP) LOCAL_LIB_ENTRY(TTL_74126_DIP) + LOCAL_LIB_ENTRY(TTL_74139_DIP) LOCAL_LIB_ENTRY(TTL_74153_DIP) LOCAL_LIB_ENTRY(TTL_74155_DIP) LOCAL_LIB_ENTRY(TTL_74156_DIP) diff --git a/src/lib/netlist/macro/nlm_ttl74xx_lib.h b/src/lib/netlist/macro/nlm_ttl74xx_lib.h index d864f148c7e..ce91782b5e6 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx_lib.h +++ b/src/lib/netlist/macro/nlm_ttl74xx_lib.h @@ -324,6 +324,9 @@ #define TTL_74125_DIP(name) \ NET_REGISTER_DEV(TTL_74125_DIP, name) +#define TTL_74139_DIP(name) \ + NET_REGISTER_DEV(TTL_74139_DIP, name) + #define TTL_74153_DIP(name) \ NET_REGISTER_DEV(TTL_74153_DIP, name) diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h index e5844bbb4ab..553387301d9 100644 --- a/src/lib/netlist/nl_errstr.h +++ b/src/lib/netlist/nl_errstr.h @@ -55,7 +55,9 @@ namespace netlist // nl_setup.cpp PERRMSGV(MF_UNABLE_TO_PARSE_MODEL_1, 1, "Unable to parse model: {1}") - PERRMSGV(MF_MODEL_ALREADY_EXISTS_1, 1, "Model already exists: {1}") + // FIXME: Add an directive MODEL_OVERWRITE to netlist language + //PERRMSGV(MF_MODEL_ALREADY_EXISTS_1, 1, "Model already exists: {1}") + PERRMSGV(MI_MODEL_OVERWRITE_1, 2, "Model already exists, overwriting {1} with {2}") PERRMSGV(MF_DEVICE_ALREADY_EXISTS_1, 1, "Device already exists: {1}") PERRMSGV(MF_UNUSED_HINT_1, 1, "Error hint {1} is not used") PERRMSGV(MF_ADDING_HINT_1, 1, "Error adding hint {1} to hint list") diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 394d5008f00..70860747f93 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -448,7 +448,12 @@ namespace netlist pstring model = plib::ucase(plib::trim(plib::left(model_in, pos))); pstring def = plib::trim(model_in.substr(pos + 1)); if (!m_abstract.m_models.insert({model, def}).second) - throw nl_exception(MF_MODEL_ALREADY_EXISTS_1(model_in)); + { + // FIXME: Add an directive MODEL_OVERWRITE to netlist language + //throw nl_exception(MF_MODEL_ALREADY_EXISTS_1(model_in)); + log().info(MI_MODEL_OVERWRITE_1(model, model_in)); + m_abstract.m_models[model] = def; + } } @@ -1623,6 +1628,7 @@ void setup_t::prepare_to_run() // resolve inputs resolve_inputs(); +#if 0 log().verbose("looking for two terms connected to rail nets ..."); for (auto & t : m_nlstate.get_device_list<analog::NETLIB_NAME(twoterm)>()) { @@ -1638,6 +1644,7 @@ void setup_t::prepare_to_run() #endif } } +#endif log().verbose("looking for unused hints ..."); for (auto &h : m_abstract.m_hints) |