diff options
-rw-r--r-- | scripts/src/netlist.lua | 8 | ||||
-rw-r--r-- | src/lib/netlist/build/makefile | 3 | ||||
-rwxr-xr-x | src/lib/netlist/buildVS/netlistlib.vcxproj | 8 | ||||
-rwxr-xr-x | src/lib/netlist/buildVS/netlistlib.vcxproj.filters | 27 | ||||
-rwxr-xr-x | src/lib/netlist/buildVS/nltool.vcxproj | 2 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_74161.cpp | 31 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_74163.cpp | 29 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_9310.cpp | 29 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_9316.cpp | 212 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_9316_base.hxx | 193 | ||||
-rw-r--r-- | src/lib/netlist/nltypes.h | 14 |
11 files changed, 324 insertions, 232 deletions
diff --git a/scripts/src/netlist.lua b/scripts/src/netlist.lua index c6c60fe0390..2b1cf9a2778 100644 --- a/scripts/src/netlist.lua +++ b/scripts/src/netlist.lua @@ -116,6 +116,9 @@ project "netlist" MAME_DIR .. "src/lib/netlist/solver/nld_ms_w.h", MAME_DIR .. "src/lib/netlist/solver/nld_ms_direct_lu.h", MAME_DIR .. "src/lib/netlist/solver/vector_base.h", + MAME_DIR .. "src/lib/netlist/devices/net_lib.cpp", + MAME_DIR .. "src/lib/netlist/devices/net_lib.h", + MAME_DIR .. "src/lib/netlist/devices/nld_9316_base.hxx", MAME_DIR .. "src/lib/netlist/devices/nld_2102A.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_2102A.h", MAME_DIR .. "src/lib/netlist/devices/nld_tms4800.cpp", @@ -162,6 +165,8 @@ project "netlist" MAME_DIR .. "src/lib/netlist/devices/nld_74125.h", MAME_DIR .. "src/lib/netlist/devices/nld_74153.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_74153.h", + MAME_DIR .. "src/lib/netlist/devices/nld_74161.cpp", + MAME_DIR .. "src/lib/netlist/devices/nld_74163.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_74164.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_74164.h", MAME_DIR .. "src/lib/netlist/devices/nld_74165.cpp", @@ -190,6 +195,7 @@ project "netlist" MAME_DIR .. "src/lib/netlist/devices/nld_82S16.h", MAME_DIR .. "src/lib/netlist/devices/nld_82S115.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_82S115.h", + MAME_DIR .. "src/lib/netlist/devices/nld_9310.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_9316.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_9316.h", MAME_DIR .. "src/lib/netlist/devices/nld_9322.cpp", @@ -212,8 +218,6 @@ project "netlist" MAME_DIR .. "src/lib/netlist/devices/nld_schmitt.h", MAME_DIR .. "src/lib/netlist/devices/nld_legacy.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_legacy.h", - MAME_DIR .. "src/lib/netlist/devices/net_lib.cpp", - MAME_DIR .. "src/lib/netlist/devices/net_lib.h", MAME_DIR .. "src/lib/netlist/devices/nld_log.cpp", MAME_DIR .. "src/lib/netlist/devices/nld_log.h", MAME_DIR .. "src/lib/netlist/devices/nld_roms.cpp", diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile index 46587cbd850..dcb1c35f105 100644 --- a/src/lib/netlist/build/makefile +++ b/src/lib/netlist/build/makefile @@ -164,6 +164,8 @@ NLOBJS := \ $(NLOBJ)/devices/nld_74123.o \ $(NLOBJ)/devices/nld_74125.o \ $(NLOBJ)/devices/nld_74153.o \ + $(NLOBJ)/devices/nld_74161.o \ + $(NLOBJ)/devices/nld_74163.o \ $(NLOBJ)/devices/nld_74164.o \ $(NLOBJ)/devices/nld_74165.o \ $(NLOBJ)/devices/nld_74166.o \ @@ -178,6 +180,7 @@ NLOBJS := \ $(NLOBJ)/devices/nld_74ls629.o \ $(NLOBJ)/devices/nld_82S16.o \ $(NLOBJ)/devices/nld_82S115.o \ + $(NLOBJ)/devices/nld_9310.o \ $(NLOBJ)/devices/nld_9316.o \ $(NLOBJ)/devices/nld_9322.o \ $(NLOBJ)/devices/nld_am2847.o \ diff --git a/src/lib/netlist/buildVS/netlistlib.vcxproj b/src/lib/netlist/buildVS/netlistlib.vcxproj index 726b81546b4..5effaa1e649 100755 --- a/src/lib/netlist/buildVS/netlistlib.vcxproj +++ b/src/lib/netlist/buildVS/netlistlib.vcxproj @@ -115,12 +115,15 @@ <ClCompile Include="..\analog\nlid_twoterm.cpp" /> <ClCompile Include="..\devices\net_lib.cpp" /> <ClCompile Include="..\devices\nld_2102A.cpp" /> - <ClCompile Include="..\devices\nld_2716.cpp" /> <ClCompile Include="..\devices\nld_4006.cpp" /> + <ClCompile Include="..\devices\nld_74125.cpp" /> + <ClCompile Include="..\devices\nld_74163.cpp" /> + <ClCompile Include="..\devices\nld_74377.cpp" /> <ClCompile Include="..\devices\nld_74393.cpp" /> <ClCompile Include="..\devices\nld_7442.cpp" /> <ClCompile Include="..\devices\nld_7492.cpp" /> <ClCompile Include="..\devices\nld_7497.cpp" /> + <ClCompile Include="..\devices\nld_roms.cpp" /> <ClCompile Include="..\devices\nld_schmitt.cpp" /> <ClCompile Include="..\devices\nld_tms4800.cpp" /> <ClCompile Include="..\devices\nld_4013.cpp" /> @@ -151,8 +154,6 @@ <ClCompile Include="..\devices\nld_7493.cpp" /> <ClCompile Include="..\devices\nld_74ls629.cpp" /> <ClCompile Include="..\devices\nld_82S115.cpp" /> - <ClCompile Include="..\devices\nld_82S123.cpp" /> - <ClCompile Include="..\devices\nld_82S126.cpp" /> <ClCompile Include="..\devices\nld_82S16.cpp" /> <ClCompile Include="..\devices\nld_9310.cpp" /> <ClCompile Include="..\devices\nld_9316.cpp" /> @@ -174,6 +175,7 @@ <ClCompile Include="..\macro\nlm_cd4xxx.cpp" /> <ClCompile Include="..\macro\nlm_opamp.cpp" /> <ClCompile Include="..\macro\nlm_other.cpp" /> + <ClCompile Include="..\macro\nlm_roms.cpp" /> <ClCompile Include="..\macro\nlm_ttl74xx.cpp" /> <ClCompile Include="..\nl_base.cpp" /> <ClCompile Include="..\nl_factory.cpp" /> diff --git a/src/lib/netlist/buildVS/netlistlib.vcxproj.filters b/src/lib/netlist/buildVS/netlistlib.vcxproj.filters index 2188b989e7e..e8aeb09c28c 100755 --- a/src/lib/netlist/buildVS/netlistlib.vcxproj.filters +++ b/src/lib/netlist/buildVS/netlistlib.vcxproj.filters @@ -162,9 +162,6 @@ <ClCompile Include="..\devices\nld_7485.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\devices\nld_2716.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\devices\nld_tms4800.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -219,18 +216,12 @@ <ClCompile Include="..\devices\nld_7474.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\devices\nld_82S126.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\devices\nlid_truthtable.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\devices\nld_tristate.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\devices\nld_82S123.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\devices\nld_legacy.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -270,6 +261,21 @@ <ClCompile Include="..\devices\nld_74393.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\devices\nld_74163.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_roms.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_74125.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_74377.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\macro\nlm_roms.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\nl_errstr.h"> @@ -476,9 +482,6 @@ <ClInclude Include="..\devices\nlid_cmos.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\devices\nld_4013.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="..\devices\nld_4020.h"> <Filter>Header Files</Filter> </ClInclude> diff --git a/src/lib/netlist/buildVS/nltool.vcxproj b/src/lib/netlist/buildVS/nltool.vcxproj index 1cf9c41818c..0cb27e86599 100755 --- a/src/lib/netlist/buildVS/nltool.vcxproj +++ b/src/lib/netlist/buildVS/nltool.vcxproj @@ -135,7 +135,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories>$(SolutionDir)..\..\</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(SolutionDir)..\..\;$(SolutionDir)..\</AdditionalIncludeDirectories> </ClCompile> <Link> <SubSystem>Console</SubSystem> diff --git a/src/lib/netlist/devices/nld_74161.cpp b/src/lib/netlist/devices/nld_74161.cpp new file mode 100644 index 00000000000..71d6453d1b1 --- /dev/null +++ b/src/lib/netlist/devices/nld_74161.cpp @@ -0,0 +1,31 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_74161.cpp + * + */ + +#include "nl_base.h" +#include "nl_factory.h" + +#include "nld_9316_base.hxx" + +// FIXME: All detail can be found in nld_9316_base.hxx +// At least gcc-7.x needs the implementations of the base device +// in different compilation units. If created in the same file +// performance degrades horrible. + +// FIXME: this file could be created programmatically + +namespace netlist +{ + namespace devices + { + + NETLIB_DEVICE_IMPL(74161, "TTL_74161", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") + NETLIB_DEVICE_IMPL(74161_dip, "TTL_74161_DIP", "") + // FIXME: This happens on copy/paste + NETLIB_DEVICE_IMPL(74161_fixme, "TTL_74161_FIXME", "+A,+B,+C,+D,+CLRQ,+LOADQ,+CLK,+ENP,+ENT,@VCC,@GND") + + } //namespace devices +} // namespace netlist diff --git a/src/lib/netlist/devices/nld_74163.cpp b/src/lib/netlist/devices/nld_74163.cpp new file mode 100644 index 00000000000..51e3b1c767d --- /dev/null +++ b/src/lib/netlist/devices/nld_74163.cpp @@ -0,0 +1,29 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_74163.cpp + * + */ + +#include "nl_base.h" +#include "nl_factory.h" + +#include "nld_9316_base.hxx" + +// FIXME: All detail can be found in nld_9316_base.hxx +// At least gcc-7.x needs the implementations of the base device +// in different compilation units. If created in the same file +// performance degrades horrible. + +// FIXME: this file could be created programmatically + +namespace netlist +{ + namespace devices + { + + NETLIB_DEVICE_IMPL(74163, "TTL_74163", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") + NETLIB_DEVICE_IMPL(74163_dip, "TTL_74163_DIP", "") + + } //namespace devices +} // namespace netlist diff --git a/src/lib/netlist/devices/nld_9310.cpp b/src/lib/netlist/devices/nld_9310.cpp new file mode 100644 index 00000000000..956ab3fb3bc --- /dev/null +++ b/src/lib/netlist/devices/nld_9310.cpp @@ -0,0 +1,29 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_9310.cpp + * + */ + +#include "nl_base.h" +#include "nl_factory.h" + +#include "nld_9316_base.hxx" + +// FIXME: All detail can be found in nld_9316_base.hxx +// At least gcc-7.x needs the implementations of the base device +// in different compilation units. If created in the same file +// performance degrades horrible. + +// FIXME: this file could be created programmatically + +namespace netlist +{ + namespace devices + { + + NETLIB_DEVICE_IMPL(9310, "TTL_9310", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") + NETLIB_DEVICE_IMPL(9310_dip, "TTL_9310_DIP", "") + + } //namespace devices +} // namespace netlist diff --git a/src/lib/netlist/devices/nld_9316.cpp b/src/lib/netlist/devices/nld_9316.cpp index e337b850308..1ebb8547a19 100644 --- a/src/lib/netlist/devices/nld_9316.cpp +++ b/src/lib/netlist/devices/nld_9316.cpp @@ -4,214 +4,26 @@ * nld_9316.cpp * */ + #include "nl_base.h" #include "nl_factory.h" -namespace netlist -{ - namespace devices - { - - // FIXME: Family needs to be set to LS for 74193. This needs some more - // thought generally. - - template <unsigned N> - static constexpr unsigned rollover(unsigned v) { return v <= N ? v : 0; } - -#if 0 - template <> - constexpr unsigned rollover<7>(unsigned v) { return v & 7; } -#endif - - template <> - constexpr unsigned rollover<15>(unsigned v) { return v & 15; } - - - template <typename D> - NETLIB_OBJECT(9316_base) - { - NETLIB_CONSTRUCTOR(9316_base) - , m_CLK(*this, "CLK", NETLIB_DELEGATE(9316_base, clk)) - , m_ENT(*this, "ENT") - , m_RC(*this, "RC") - , m_LOADQ(*this, "LOADQ") - , m_ENP(*this, "ENP") - , m_CLRQ(*this, "CLRQ") - , m_ABCD(*this, {"A", "B", "C", "D"}, NETLIB_DELEGATE(9316_base, abcd)) - , 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_power_pins(*this) - { - } - - 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())) && (!D::ASYNC::value() || CLRQ)) - { - m_CLK.activate_lh(); - } - else - { - m_CLK.inactivate(); - if (D::ASYNC::value() && !CLRQ && (m_cnt>0)) - { - m_cnt = 0; - m_Q.push(m_cnt, D::tCLR::value(0)); - } - } - m_RC.push(m_ent && (m_cnt == D::MAXCNT::value()), D::tRC::value(0)); - } - - NETLIB_HANDLERI(clk) - { - if (!D::ASYNC::value() && !m_CLRQ()) - { - m_cnt = 0; - m_Q.push(m_cnt, D::tCLR::value(0)); - } - else - { - //const auto cnt = (m_loadq ? (m_cnt + 1) & D::MAXCNT::value : m_abcd); - const auto cnt = (m_loadq ? rollover<D::MAXCNT::value()>(m_cnt + 1) : m_abcd); - m_RC.push(m_ent && (cnt == D::MAXCNT::value()), D::tRC::value(0)); - m_Q.push(cnt, D::tLDCNT::value(0)); - m_cnt = static_cast<unsigned>(cnt); - } - } - - NETLIB_HANDLERI(abcd) - { - m_abcd = static_cast<unsigned>(m_ABCD()); - } - - logic_input_t m_CLK; - logic_input_t m_ENT; - - logic_output_t m_RC; - - logic_input_t m_LOADQ; +#include "nld_9316_base.hxx" - logic_input_t m_ENP; - logic_input_t m_CLRQ; +// FIXME: All detail can be found in nld_9316_base.hxx +// At least gcc-7.x needs the implementations of the base device +// in different compilation units. If created in the same file +// performance degrades horrible. - object_array_t<logic_input_t, 4> m_ABCD; - object_array_t<logic_output_t, 4> m_Q; +// FIXME: this file could be created programmatically - /* counter state */ - state_var<unsigned> m_cnt; - /* cached pins */ - state_var<unsigned> m_abcd; - state_var_sig m_loadq; - state_var_sig m_ent; - nld_power_pins m_power_pins; - - }; - - template <typename D> - NETLIB_OBJECT(9316_dip_base) - { - NETLIB_CONSTRUCTOR(9316_dip_base) - , A(*this, "A") - { - this->register_subalias("1", "A.CLRQ"); - this->register_subalias("2", "A.CLK"); - this->register_subalias("3", "A.A"); - this->register_subalias("4", "A.B"); - this->register_subalias("5", "A.C"); - this->register_subalias("6", "A.D"); - this->register_subalias("7", "A.ENP"); - this->register_subalias("8", "A.GND"); - - this->register_subalias("9", "A.LOADQ"); - this->register_subalias("10", "A.ENT"); - this->register_subalias("11", "A.QD"); - this->register_subalias("12", "A.QC"); - this->register_subalias("13", "A.QB"); - this->register_subalias("14", "A.QA"); - this->register_subalias("15", "A.RC"); - this->register_subalias("16", "A.VCC"); - } - private: - NETLIB_SUB(9316_base)<D> A; - }; - - struct desc_9316 : public desc_base - { - using ASYNC = fdesc_const_t<bool, true>; - using MAXCNT = fdesc_const_t<unsigned, 15>; - using tRC = time_ns<27>; - using tCLR = time_ns<36>; - using tLDCNT = time_ns<20>; - }; - - struct desc_9310 : public desc_base - { - using ASYNC = fdesc_const_t<bool, true>; - using MAXCNT = fdesc_const_t<unsigned, 10>; - using tRC = time_ns<27>; - using tCLR = time_ns<36>; - using tLDCNT = time_ns<20>; - }; - - struct desc_74161 : public desc_base - { - using ASYNC = fdesc_const_t<bool, true>; - using MAXCNT = fdesc_const_t<unsigned, 15>; - using tRC = time_ns<28>; - using tCLR = time_ns<37>; - using tLDCNT = time_ns<21>; - }; - - struct desc_74163 : public desc_base +namespace netlist +{ + namespace devices { - using ASYNC = fdesc_const_t<bool, false>; - using MAXCNT = fdesc_const_t<unsigned, 15>; - using tRC = time_ns<28>; - using tCLR = time_ns<37>; - using tLDCNT = time_ns<21>; - }; - - using NETLIB_NAME(9310) = NETLIB_NAME(9316_base)<desc_9310>; - using NETLIB_NAME(9316) = NETLIB_NAME(9316_base)<desc_9316>; - using NETLIB_NAME(74161) = NETLIB_NAME(9316_base)<desc_74161>; - using NETLIB_NAME(74161_fixme) = NETLIB_NAME(9316_base)<desc_74161>; - using NETLIB_NAME(74163) = NETLIB_NAME(9316_base)<desc_74163>; - - using NETLIB_NAME(9310_dip) = NETLIB_NAME(9316_dip_base)<desc_9310>; - using NETLIB_NAME(9316_dip) = NETLIB_NAME(9316_dip_base)<desc_9316>; - using NETLIB_NAME(74161_dip) = NETLIB_NAME(9316_dip_base)<desc_74161>; - using NETLIB_NAME(74163_dip) = NETLIB_NAME(9316_dip_base)<desc_74163>; - - NETLIB_DEVICE_IMPL(9310, "TTL_9310", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") - NETLIB_DEVICE_IMPL(9310_dip, "TTL_9310_DIP", "") - - NETLIB_DEVICE_IMPL(9316, "TTL_9316", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") - NETLIB_DEVICE_IMPL(9316_dip, "TTL_9316_DIP", "") - -#if 1 - NETLIB_DEVICE_IMPL(74161, "TTL_74161", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") - NETLIB_DEVICE_IMPL(74161_dip, "TTL_74161_DIP", "") - // FIXME: This happens on copy/paste - NETLIB_DEVICE_IMPL(74161_fixme, "TTL_74161_FIXME", "+A,+B,+C,+D,+CLRQ,+LOADQ,+CLK,+ENP,+ENT,@VCC,@GND") - NETLIB_DEVICE_IMPL(74163, "TTL_74163", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") - NETLIB_DEVICE_IMPL(74163_dip, "TTL_74163_DIP", "") -#endif + NETLIB_DEVICE_IMPL(9316, "TTL_9316", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND") + NETLIB_DEVICE_IMPL(9316_dip, "TTL_9316_DIP", "") } //namespace devices } // namespace netlist diff --git a/src/lib/netlist/devices/nld_9316_base.hxx b/src/lib/netlist/devices/nld_9316_base.hxx new file mode 100644 index 00000000000..8f0b0b9ee99 --- /dev/null +++ b/src/lib/netlist/devices/nld_9316_base.hxx @@ -0,0 +1,193 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_9316_base.hxx + * + */ + +#include "nl_base.h" +#include "nl_factory.h" + +namespace netlist +{ + namespace devices + { + + template <unsigned N> + static constexpr unsigned rollover(unsigned v) { return v <= N ? v : 0; } + + template <> + constexpr unsigned rollover<15>(unsigned v) { return v & 15; } + + template <typename D> + NETLIB_OBJECT(9316_base) + { + NETLIB_CONSTRUCTOR(9316_base) + , m_CLK(*this, "CLK", NETLIB_DELEGATE(9316_base, clk)) + , m_ENT(*this, "ENT") + , m_RC(*this, "RC") + , m_LOADQ(*this, "LOADQ") + , m_ENP(*this, "ENP") + , m_CLRQ(*this, "CLRQ") + , m_ABCD(*this, {"A", "B", "C", "D"}, NETLIB_DELEGATE(9316_base, abcd)) + , 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_power_pins(*this) + { + } + + 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())) && (!D::ASYNC::value || CLRQ)) + { + m_CLK.activate_lh(); + } + else + { + m_CLK.inactivate(); + if (D::ASYNC::value && !CLRQ && (m_cnt>0)) + { + m_cnt = 0; + m_Q.push(m_cnt, D::tCLR::value(0)); + } + } + m_RC.push(m_ent && (m_cnt == D::MAXCNT::value), D::tRC::value(0)); + } + + NETLIB_HANDLERI(clk) + { + if (!D::ASYNC::value && !m_CLRQ()) + { + m_cnt = 0; + m_Q.push(m_cnt, D::tCLR::value(0)); + } + else + { + //const auto cnt = (m_loadq ? (m_cnt + 1) & D::MAXCNT::value : m_abcd); + const auto cnt = (m_loadq ? rollover<D::MAXCNT::value>(m_cnt + 1) : m_abcd); + m_RC.push(m_ent && (cnt == D::MAXCNT::value), D::tRC::value(0)); + m_Q.push(cnt, D::tLDCNT::value(0)); + m_cnt = static_cast<unsigned>(cnt); + } + } + + NETLIB_HANDLERI(abcd) + { + m_abcd = static_cast<unsigned>(m_ABCD()); + } + + logic_input_t m_CLK; + logic_input_t m_ENT; + + logic_output_t m_RC; + + logic_input_t m_LOADQ; + + logic_input_t m_ENP; + logic_input_t m_CLRQ; + + object_array_t<logic_input_t, 4> m_ABCD; + object_array_t<logic_output_t, 4> m_Q; + + /* counter state */ + state_var<unsigned> m_cnt; + /* cached pins */ + state_var<unsigned> m_abcd; + state_var_sig m_loadq; + state_var_sig m_ent; + nld_power_pins m_power_pins; + + }; + + template <typename D> + NETLIB_OBJECT(9316_dip_base) + { + NETLIB_CONSTRUCTOR(9316_dip_base) + , A(*this, "A") + { + this->register_subalias("1", "A.CLRQ"); + this->register_subalias("2", "A.CLK"); + this->register_subalias("3", "A.A"); + this->register_subalias("4", "A.B"); + this->register_subalias("5", "A.C"); + this->register_subalias("6", "A.D"); + this->register_subalias("7", "A.ENP"); + this->register_subalias("8", "A.GND"); + + this->register_subalias("9", "A.LOADQ"); + this->register_subalias("10", "A.ENT"); + this->register_subalias("11", "A.QD"); + this->register_subalias("12", "A.QC"); + this->register_subalias("13", "A.QB"); + this->register_subalias("14", "A.QA"); + this->register_subalias("15", "A.RC"); + this->register_subalias("16", "A.VCC"); + } + private: + NETLIB_SUB(9316_base)<D> A; + }; + + struct desc_9316 : public desc_base + { + using ASYNC = desc_const_t<bool, true>; + using MAXCNT = desc_const_t<unsigned, 15>; + using tRC = time_ns<27>; + using tCLR = time_ns<36>; + using tLDCNT = time_ns<20>; + }; + + struct desc_9310 : public desc_base + { + using ASYNC = desc_const_t<bool, true>; + using MAXCNT = desc_const_t<unsigned, 10>; + using tRC = time_ns<27>; + using tCLR = time_ns<36>; + using tLDCNT = time_ns<20>; + }; + + struct desc_74161 : public desc_base + { + using ASYNC = desc_const_t<bool, true>; + using MAXCNT = desc_const_t<unsigned, 15>; + using tRC = time_ns<27>; + using tCLR = time_ns<36>; + using tLDCNT = time_ns<20>; + }; + + struct desc_74163 : public desc_base + { + using ASYNC = desc_const_t<bool, false>; + using MAXCNT = desc_const_t<unsigned, 15>; + using tRC = time_ns<27>; + using tCLR = time_ns<36>; + using tLDCNT = time_ns<20>; + }; + + using NETLIB_NAME(9310) = NETLIB_NAME(9316_base)<desc_9310>; + using NETLIB_NAME(9316) = NETLIB_NAME(9316_base)<desc_9316>; + using NETLIB_NAME(74161) = NETLIB_NAME(9316_base)<desc_74161>; + using NETLIB_NAME(74161_fixme) = NETLIB_NAME(9316_base)<desc_74161>; + using NETLIB_NAME(74163) = NETLIB_NAME(9316_base)<desc_74163>; + + using NETLIB_NAME(9310_dip) = NETLIB_NAME(9316_dip_base)<desc_9310>; + using NETLIB_NAME(9316_dip) = NETLIB_NAME(9316_dip_base)<desc_9316>; + using NETLIB_NAME(74161_dip) = NETLIB_NAME(9316_dip_base)<desc_74161>; + using NETLIB_NAME(74163_dip) = NETLIB_NAME(9316_dip_base)<desc_74163>; + + } //namespace devices +} // namespace netlist diff --git a/src/lib/netlist/nltypes.h b/src/lib/netlist/nltypes.h index 49591355988..149d59097bf 100644 --- a/src/lib/netlist/nltypes.h +++ b/src/lib/netlist/nltypes.h @@ -206,20 +206,6 @@ namespace netlist } }; - template<typename T, T V> - struct fintegral_constant - { - static constexpr const T value() noexcept { return V; } - typedef T value_type; - typedef fintegral_constant<T, V> type; - }; - - template <std::size_t V> - using fdesc_const = fintegral_constant<std::size_t, V>; - - template <typename T, T V> - using fdesc_const_t = fintegral_constant<T, V>; - /// \brief: used define a constant in device description struct /// /// See the 74125 implementation |