summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/devices/nld_truthtable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/devices/nld_truthtable.cpp')
-rw-r--r--src/lib/netlist/devices/nld_truthtable.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/lib/netlist/devices/nld_truthtable.cpp b/src/lib/netlist/devices/nld_truthtable.cpp
index 9ed524e58b1..29895ae8b4c 100644
--- a/src/lib/netlist/devices/nld_truthtable.cpp
+++ b/src/lib/netlist/devices/nld_truthtable.cpp
@@ -7,13 +7,14 @@
#include "nld_truthtable.h"
#include "plib/plists.h"
+#include "nl_setup.h"
namespace netlist
{
namespace devices
{
- template<unsigned m_NI, unsigned m_NO, int has_state>
+ template<unsigned m_NI, unsigned m_NO>
class netlist_factory_truthtable_t : public netlist_base_factory_truthtable_t
{
P_PREVENT_COPYING(netlist_factory_truthtable_t)
@@ -25,11 +26,11 @@ namespace netlist
plib::owned_ptr<device_t> Create(netlist_t &anetlist, const pstring &name) override
{
- typedef nld_truthtable_t<m_NI, m_NO, has_state> tt_type;
+ typedef nld_truthtable_t<m_NI, m_NO> tt_type;
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, has_state>::truthtable_t m_ttbl;
+ typename nld_truthtable_t<m_NI, m_NO>::truthtable_t m_ttbl;
};
static const uint_least64_t all_set = ~((uint_least64_t) 0);
@@ -259,20 +260,17 @@ void truthtable_desc_t::setup(const plib::pstring_vector_t &truthtable, uint_lea
}
-#define ENTRYX(n, m, h) case (n * 1000 + m * 10 + h): \
- { using xtype = netlist_factory_truthtable_t<n, m, h>; \
- return plib::owned_ptr<netlist_base_factory_truthtable_t>::Create<xtype>(name,classname,def_param); } break
-
-#define ENTRYY(n, m) ENTRYX(n, m, 0); ENTRYX(n, m, 1)
+#define ENTRYY(n, m) case (n * 100 + m): \
+ { using xtype = netlist_factory_truthtable_t<n, m>; \
+ ret = new xtype(desc.name, desc.classname, desc.def_param); } break
#define ENTRY(n) ENTRYY(n, 1); ENTRYY(n, 2); ENTRYY(n, 3); ENTRYY(n, 4); ENTRYY(n, 5); ENTRYY(n, 6)
-plib::owned_ptr<netlist_base_factory_truthtable_t> nl_tt_factory_create(const unsigned ni, const unsigned no,
- const unsigned has_state,
- const pstring &name, const pstring &classname,
- const pstring &def_param)
+void tt_factory_create(setup_t &setup, tt_desc &desc)
{
- switch (ni * 1000 + no * 10 + has_state)
+ netlist_base_factory_truthtable_t *ret;
+
+ switch (desc.ni * 100 + desc.no)
{
ENTRY(1);
ENTRY(2);
@@ -285,10 +283,13 @@ plib::owned_ptr<netlist_base_factory_truthtable_t> nl_tt_factory_create(const un
ENTRY(9);
ENTRY(10);
default:
- pstring msg = plib::pfmt("unable to create truthtable<{1},{2},{3}>")(ni)(no)(has_state);
+ pstring msg = plib::pfmt("unable to create truthtable<{1},{2}>")(desc.ni)(desc.no);
nl_assert_always(false, msg);
}
- //return nullptr;
+ ret->m_desc = desc.desc;
+ 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