summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/machine/netlist.cpp37
-rw-r--r--src/devices/machine/netlist.h2
-rw-r--r--src/lib/netlist/devices/nld_74125.cpp10
-rw-r--r--src/lib/netlist/devices/nlid_system.h2
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.cpp10
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.h2
-rw-r--r--src/lib/netlist/nl_base.cpp22
-rw-r--r--src/lib/netlist/nl_base.h68
-rw-r--r--src/lib/netlist/nl_factory.cpp4
-rw-r--r--src/lib/netlist/nl_factory.h21
-rw-r--r--src/lib/netlist/nl_setup.cpp20
-rw-r--r--src/lib/netlist/nl_setup.h16
-rw-r--r--src/lib/netlist/nltypes.h37
-rw-r--r--src/lib/netlist/plib/palloc.h34
-rw-r--r--src/lib/netlist/plib/parray.h8
-rw-r--r--src/lib/netlist/plib/pfmtlog.h10
-rw-r--r--src/lib/netlist/plib/pfunction.cpp4
-rw-r--r--src/lib/netlist/plib/pmath.h30
-rw-r--r--src/lib/netlist/plib/pmempool.h12
-rw-r--r--src/lib/netlist/plib/ppreprocessor.cpp4
-rw-r--r--src/lib/netlist/plib/pstate.h8
-rw-r--r--src/lib/netlist/plib/pstonum.h6
-rw-r--r--src/lib/netlist/plib/pstream.h4
-rw-r--r--src/lib/netlist/plib/pstring.h8
-rw-r--r--src/lib/netlist/plib/ptime.h4
-rw-r--r--src/lib/netlist/plib/putil.h26
-rw-r--r--src/lib/netlist/prg/nltool.cpp26
-rwxr-xr-xsrc/lib/netlist/prg/nlwav.cpp24
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h2
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp60
-rw-r--r--src/lib/netlist/solver/nld_solver.h7
-rw-r--r--src/lib/netlist/tools/nl_convert.cpp27
-rwxr-xr-xsrc/lib/netlist/tools/nl_convert.h20
33 files changed, 277 insertions, 298 deletions
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp
index 9fd71f0bc3c..1e290a2d29e 100644
--- a/src/devices/machine/netlist.cpp
+++ b/src/devices/machine/netlist.cpp
@@ -124,10 +124,10 @@ protected:
}
}
- plib::unique_ptr<plib::dynlib_base> static_solver_lib() const noexcept override
+ netlist::host_arena::unique_ptr<plib::dynlib_base> static_solver_lib() const noexcept override
{
//return plib::make_unique<plib::dynlib_static>(nullptr);
- return plib::make_unique<plib::dynlib_static>(nl_static_solver_syms);
+ return netlist::host_arena::make_unique<plib::dynlib_static>(nl_static_solver_syms);
}
private:
@@ -167,9 +167,9 @@ protected:
}
}
- plib::unique_ptr<plib::dynlib_base> static_solver_lib() const noexcept override
+ netlist::host_arena::unique_ptr<plib::dynlib_base> static_solver_lib() const noexcept override
{
- return plib::make_unique<plib::dynlib_static>(nullptr);
+ return netlist::host_arena::make_unique<plib::dynlib_static>(nullptr);
}
private:
@@ -181,12 +181,12 @@ class netlist_mame_device::netlist_mame_t : public netlist::netlist_state_t
public:
netlist_mame_t(netlist_mame_device &parent, const pstring &name)
- : netlist::netlist_state_t(name, plib::make_unique<netlist_mame_device::netlist_mame_callbacks_t>(parent))
+ : netlist::netlist_state_t(name, netlist::host_arena::make_unique<netlist_mame_device::netlist_mame_callbacks_t>(parent))
, m_parent(parent)
{
}
- netlist_mame_t(netlist_mame_device &parent, const pstring &name, plib::unique_ptr<netlist::callbacks_t> cbs)
+ netlist_mame_t(netlist_mame_device &parent, const pstring &name, netlist::host_arena::unique_ptr<netlist::callbacks_t> cbs)
: netlist::netlist_state_t(name, std::move(cbs))
, m_parent(parent)
{
@@ -234,13 +234,12 @@ class netlist_source_memregion_t : public netlist::source_netlist_t
{
public:
-
netlist_source_memregion_t(device_t &dev, pstring name)
: netlist::source_netlist_t(), m_dev(dev), m_name(name)
{
}
- virtual plib::unique_ptr<std::istream> stream(const pstring &name) override;
+ virtual stream_ptr stream(const pstring &name) override;
private:
device_t &m_dev;
pstring m_name;
@@ -251,7 +250,7 @@ class netlist_data_memregions_t : public netlist::source_data_t
public:
netlist_data_memregions_t(const device_t &dev);
- virtual plib::unique_ptr<std::istream> stream(const pstring &name) override;
+ virtual stream_ptr stream(const pstring &name) override;
private:
const device_t &m_dev;
@@ -262,12 +261,12 @@ private:
// memregion source support
// ----------------------------------------------------------------------------------------
-plib::unique_ptr<std::istream> netlist_source_memregion_t::stream(const pstring &name)
+netlist_source_memregion_t::stream_ptr netlist_source_memregion_t::stream(const pstring &name)
{
if (m_dev.has_running_machine())
{
memory_region *mem = m_dev.memregion(m_name.c_str());
- auto ret(plib::make_unique<std::istringstream>(pstring(reinterpret_cast<char *>(mem->base()), mem->bytes())));
+ auto ret(std::make_unique<std::istringstream>(pstring(reinterpret_cast<char *>(mem->base()), mem->bytes())));
ret->imbue(std::locale::classic());
return MOVE_UNIQUE_PTR(ret);
}
@@ -300,7 +299,7 @@ static bool rom_exists(device_t &root, pstring name)
return false;
}
-plib::unique_ptr<std::istream> netlist_data_memregions_t::stream(const pstring &name)
+netlist_data_memregions_t::stream_ptr netlist_data_memregions_t::stream(const pstring &name)
{
//memory_region *mem = static_cast<netlist_mame_device::netlist_mame_t &>(setup().setup().exec()).parent().memregion(name.c_str());
if (m_dev.has_running_machine())
@@ -308,12 +307,12 @@ plib::unique_ptr<std::istream> netlist_data_memregions_t::stream(const pstring &
memory_region *mem = m_dev.memregion(name.c_str());
if (mem != nullptr)
{
- auto ret(plib::make_unique<std::istringstream>(std::string(reinterpret_cast<char *>(mem->base()), mem->bytes()), std::ios_base::binary));
+ auto ret(std::make_unique<std::istringstream>(std::string(reinterpret_cast<char *>(mem->base()), mem->bytes()), std::ios_base::binary));
ret->imbue(std::locale::classic());
return MOVE_UNIQUE_PTR(ret);
}
else
- return plib::unique_ptr<std::istream>(nullptr);
+ return stream_ptr(nullptr);
}
else
{
@@ -321,12 +320,12 @@ plib::unique_ptr<std::istream> netlist_data_memregions_t::stream(const pstring &
if (rom_exists(m_dev.mconfig().root_device(), pstring(m_dev.tag()) + ":" + name))
{
// Create an empty stream.
- auto ret(plib::make_unique<std::istringstream>(std::ios_base::binary));
+ auto ret(std::make_unique<std::istringstream>(std::ios_base::binary));
ret->imbue(std::locale::classic());
return MOVE_UNIQUE_PTR(ret);
}
else
- return plib::unique_ptr<std::istream>(nullptr);
+ return stream_ptr(nullptr);
}
}
@@ -973,11 +972,11 @@ void netlist_mame_device::common_dev_start(netlist::netlist_state_t *lnetlist) c
}
}
-plib::unique_ptr<netlist::netlist_state_t> netlist_mame_device::base_validity_check(validity_checker &valid) const
+netlist::host_arena::unique_ptr<netlist::netlist_state_t> netlist_mame_device::base_validity_check(validity_checker &valid) const
{
try
{
- auto lnetlist = plib::make_unique<netlist::netlist_state_t>("netlist", plib::make_unique<netlist_validate_callbacks_t>());
+ auto lnetlist = netlist::host_arena::make_unique<netlist::netlist_state_t>("netlist", netlist::host_arena::make_unique<netlist_validate_callbacks_t>());
// enable validation mode
lnetlist->set_extended_validation(true);
common_dev_start(lnetlist.get());
@@ -1008,7 +1007,7 @@ plib::unique_ptr<netlist::netlist_state_t> netlist_mame_device::base_validity_ch
{
osd_printf_error("%s\n", err.what());
}
- return plib::unique_ptr<netlist::netlist_state_t>(nullptr);
+ return netlist::host_arena::unique_ptr<netlist::netlist_state_t>(nullptr);
}
void netlist_mame_device::device_validity_check(validity_checker &valid) const
diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h
index 0ac6753ea52..c5111e5c80e 100644
--- a/src/devices/machine/netlist.h
+++ b/src/devices/machine/netlist.h
@@ -111,7 +111,7 @@ protected:
virtual void device_pre_save() override;
virtual void device_clock_changed() override;
- plib::unique_ptr<netlist::netlist_state_t> base_validity_check(validity_checker &valid) const;
+ netlist::host_arena::unique_ptr<netlist::netlist_state_t> base_validity_check(validity_checker &valid) const;
attotime m_cur_time;
attotime m_attotime_per_clock;
diff --git a/src/lib/netlist/devices/nld_74125.cpp b/src/lib/netlist/devices/nld_74125.cpp
index d803b80d984..d2c873a0e17 100644
--- a/src/lib/netlist/devices/nld_74125.cpp
+++ b/src/lib/netlist/devices/nld_74125.cpp
@@ -13,19 +13,19 @@
namespace netlist
{
template <typename T>
- struct uptr : public unique_pool_ptr<T>
+ struct uptr : public device_arena::unique_ptr<T>
{
uptr() = default;
- using base_type = unique_pool_ptr<T>;
+ using base_type = device_arena::unique_ptr<T>;
template<typename O, typename... Args>
uptr(O &owner, const pstring &name, Args&&... args)
- : unique_pool_ptr<T>(owner.template make_pool_object<T>(owner, name, std::forward<Args>(args)...))
+ : device_arena::unique_ptr<T>(owner.template make_pool_object<T>(owner, name, std::forward<Args>(args)...))
{ }
- constexpr auto operator ()() noexcept -> decltype((*unique_pool_ptr<T>::get())()) { return (*this->get())(); }
- constexpr auto operator ()() const noexcept -> const decltype((*unique_pool_ptr<T>::get())()) { return (*this->get())(); }
+ constexpr auto operator ()() noexcept -> decltype((*device_arena::unique_ptr<T>::get())()) { return (*this->get())(); }
+ constexpr auto operator ()() const noexcept -> const decltype((*device_arena::unique_ptr<T>::get())()) { return (*this->get())(); }
};
namespace devices
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index 97a3c68e2b8..fc1bfefd84b 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -380,7 +380,7 @@ namespace devices
param_int_t m_N;
param_str_t m_func;
analog_output_t m_Q;
- std::vector<unique_pool_ptr<analog_input_t>> m_I;
+ std::vector<device_arena::unique_ptr<analog_input_t>> m_I;
pf_type::values_container m_vals;
state_var<pf_type> m_compiled;
diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp
index ea29be363ce..1718f53560d 100644
--- a/src/lib/netlist/devices/nlid_truthtable.cpp
+++ b/src/lib/netlist/devices/nlid_truthtable.cpp
@@ -434,7 +434,7 @@ namespace devices
: truthtable_base_element_t(name, std::move(props))
{ }
- unique_pool_ptr<core_device_t> make_device(nlmempool &pool, netlist_state_t &anetlist, const pstring &name) override
+ device_arena::unique_ptr<core_device_t> make_device(device_arena &pool, netlist_state_t &anetlist, const pstring &name) override
{
using tt_type = nld_truthtable_t<m_NI, m_NO>;
@@ -451,7 +451,7 @@ namespace devices
return pool.make_unique<tt_type>(anetlist, name, m_family_name, *m_ttbl, m_desc);
}
private:
- unique_pool_ptr<typename nld_truthtable_t<m_NI, m_NO>::truthtable_t> m_ttbl;
+ device_arena::unique_ptr<typename nld_truthtable_t<m_NI, m_NO>::truthtable_t> m_ttbl;
};
tt_bitset truthtable_parser::calculate_ignored_inputs(tt_bitset state) const
@@ -670,16 +670,16 @@ namespace factory
#define ENTRYY(n, m, s) case (n * 100 + m): \
{ using xtype = devices::netlist_factory_truthtable_t<n, m>; \
auto cs=s; \
- ret = plib::make_unique<xtype>(desc.name, std::move(cs)); } \
+ ret = host_arena::make_unique<xtype>(desc.name, std::move(cs)); } \
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<truthtable_base_element_t> truthtable_create(tt_desc &desc, properties &&props)
+ host_arena::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc, properties &&props)
{
- plib::unique_ptr<truthtable_base_element_t> ret;
+ host_arena::unique_ptr<truthtable_base_element_t> ret;
switch (desc.ni * 100 + desc.no)
{
diff --git a/src/lib/netlist/devices/nlid_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h
index 14ee3d00624..e9daa32e47d 100644
--- a/src/lib/netlist/devices/nlid_truthtable.h
+++ b/src/lib/netlist/devices/nlid_truthtable.h
@@ -26,7 +26,7 @@ namespace netlist
pstring m_family_name;
};
- plib::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc,
+ host_arena::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc,
properties &&props);
} // namespace factory
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 87f692c1b29..532e23149c3 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -29,9 +29,9 @@ namespace netlist
// callbacks_t
// ----------------------------------------------------------------------------------------
- plib::unique_ptr<plib::dynlib_base> callbacks_t:: static_solver_lib() const
+ host_arena::unique_ptr<plib::dynlib_base> callbacks_t:: static_solver_lib() const
{
- return plib::make_unique<plib::dynlib_static>(nullptr);
+ return host_arena::make_unique<plib::dynlib_static>(nullptr);
}
// ----------------------------------------------------------------------------------------
@@ -124,7 +124,7 @@ namespace netlist
// ----------------------------------------------------------------------------------------
netlist_state_t::netlist_state_t(const pstring &name,
- plib::unique_ptr<callbacks_t> &&callbacks)
+ host_arena::unique_ptr<callbacks_t> &&callbacks)
: m_callbacks(std::move(callbacks)) // Order is important here
, m_log(*m_callbacks)
, m_extended_validation(false)
@@ -133,7 +133,7 @@ namespace netlist
m_lib = m_callbacks->static_solver_lib();
- m_setup = plib::make_unique<setup_t>(*this);
+ m_setup = host_arena::make_unique<setup_t>(*this);
// create the run interface
m_netlist = m_pool.make_unique<netlist_t>(*this, name);
@@ -145,7 +145,7 @@ namespace netlist
devices::initialize_factory(m_setup->parser().factory());
// Add default include file
- using a = plib::psource_str_t<plib::psource_t>;
+ using a = plib::psource_str_t;
const pstring content =
"#define RES_R(res) (res) \n"
"#define RES_K(res) ((res) * 1e3) \n"
@@ -498,7 +498,7 @@ namespace netlist
, m_active_outputs(*this, "m_active_outputs", 1)
{
//printf("owned device: %s\n", this->name().c_str());
- owner.state().register_device(this->name(), owned_pool_ptr<core_device_t>(this, false));
+ owner.state().register_device(this->name(), device_arena::owned_ptr<core_device_t>(this, false));
if (exec().stats_enabled())
m_stats = owner.state().make_pool_object<stats_t>();
}
@@ -778,7 +778,7 @@ namespace netlist
{
plib::unused_var(dummy);
this->set_net(&m_my_net);
- state().register_net(owned_pool_ptr<logic_net_t>(&m_my_net, false));
+ state().register_net(device_arena::owned_ptr<logic_net_t>(&m_my_net, false));
state().setup().register_term(*this);
}
@@ -807,7 +807,7 @@ namespace netlist
: analog_t(dev, aname, STATE_OUT)
, m_my_net(dev.state(), name() + ".net", this)
{
- state().register_net(owned_pool_ptr<analog_net_t>(&m_my_net, false));
+ state().register_net(device_arena::owned_ptr<analog_net_t>(&m_my_net, false));
this->set_net(&m_my_net);
//net().m_cur_Analog = NL_FCONST(0.0);
@@ -869,7 +869,7 @@ namespace netlist
param_str_t::param_str_t(core_device_t &device, const pstring &name, const pstring &val)
: param_t(device, name)
{
- m_param = plib::make_unique<pstring>(val);
+ m_param = host_arena::make_unique<pstring>(val);
*m_param = device.state().setup().get_initial_param_val(this->name(),val);
}
@@ -877,7 +877,7 @@ namespace netlist
: param_t(name)
{
// deviceless parameter, no registration, owner is responsible
- m_param = plib::make_unique<pstring>(val);
+ m_param = host_arena::make_unique<pstring>(val);
*m_param = state.setup().get_initial_param_val(this->name(),val);
}
@@ -912,7 +912,7 @@ namespace netlist
}
- plib::unique_ptr<std::istream> param_data_t::stream()
+ std::unique_ptr<std::istream> param_data_t::stream()
{
return device().state().parser().get_data_stream(str());
}
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 9bccb152c67..f5ac1c4408b 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -186,7 +186,7 @@ class NETLIB_NAME(name) : public delegator_t<base_device_t>
#define NETLIB_RESETI() virtual void reset() override
#define NETLIB_SUB(chip) nld_ ## chip
-#define NETLIB_SUB_UPTR(ns, chip) unique_pool_ptr< ns :: nld_ ## chip >
+#define NETLIB_SUB_UPTR(ns, chip) device_arena::unique_ptr< ns :: nld_ ## chip >
#define NETLIB_HANDLER(chip, name) void NETLIB_NAME(chip) :: name() noexcept
#define NETLIB_UPDATE(chip) NETLIB_HANDLER(chip, update)
@@ -296,9 +296,9 @@ namespace netlist
virtual ~logic_family_desc_t() noexcept = default;
- virtual unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist, const pstring &name,
+ virtual device_arena::unique_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist, const pstring &name,
const logic_output_t *proxied) const = 0;
- virtual unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name,
+ virtual device_arena::unique_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name,
const logic_input_t *proxied) const = 0;
nl_fptype low_thresh_V(nl_fptype VN, nl_fptype VP) const noexcept{ return VN + (VP - VN) * m_low_thresh_PCNT; }
@@ -576,7 +576,7 @@ namespace netlist
// to ease template design
template<typename T, typename... Args>
- unique_pool_ptr<T> make_pool_object(Args&&... args);
+ device_arena::unique_ptr<T> make_pool_object(Args&&... args);
private:
netlist_t & m_netlist;
@@ -1288,7 +1288,7 @@ namespace netlist
virtual void changed() noexcept;
pstring str() const noexcept { pstring ret = *m_param; return ret;}
private:
- plib::unique_ptr<pstring> m_param;
+ host_arena::unique_ptr<pstring> m_param;
};
// -----------------------------------------------------------------------------
@@ -1303,12 +1303,12 @@ namespace netlist
class value_base_t
{
public:
- template <typename P, typename Y=T, typename DUMMY = typename std::enable_if<plib::is_arithmetic<Y>::value>::type>
+ template <typename P, typename Y=T, typename DUMMY = std::enable_if_t<plib::is_arithmetic<Y>::value>>
value_base_t(P &param, const pstring &name)
: m_value(static_cast<T>(param.value(name)))
{
}
- template <typename P, typename Y=T, typename std::enable_if<!plib::is_arithmetic<Y>::value, int>::type = 0>
+ template <typename P, typename Y=T, std::enable_if_t<!plib::is_arithmetic<Y>::value, int> = 0>
value_base_t(P &param, const pstring &name)
: m_value(static_cast<T>(param.value_str(name)))
{
@@ -1349,7 +1349,7 @@ namespace netlist
{
}
- plib::unique_ptr<std::istream> stream();
+ std::unique_ptr<std::istream> stream();
protected:
void changed() noexcept override { }
};
@@ -1452,7 +1452,7 @@ namespace netlist
private:
bool m_hint_deactivate;
state_var_s32 m_active_outputs;
- unique_pool_ptr<stats_t> m_stats;
+ device_arena::unique_ptr<stats_t> m_stats;
};
// -----------------------------------------------------------------------------
@@ -1470,7 +1470,7 @@ namespace netlist
~base_device_t() noexcept override = default;
template<class O, class C, typename... Args>
- void create_and_register_subdevice(O& owner, const pstring &name, unique_pool_ptr<C> &dev, Args&&... args);
+ void create_and_register_subdevice(O& owner, const pstring &name, device_arena::unique_ptr<C> &dev, Args&&... args);
void register_subalias(const pstring &name, const detail::core_terminal_t &term);
void register_subalias(const pstring &name, const pstring &aliased);
@@ -1574,12 +1574,12 @@ namespace netlist
{
public:
- using nets_collection_type = std::vector<owned_pool_ptr<detail::net_t>>;
- using family_collection_type = std::unordered_map<pstring, plib::unique_ptr<logic_family_desc_t>>;
+ using nets_collection_type = std::vector<device_arena::owned_ptr<detail::net_t>>;
+ using family_collection_type = std::unordered_map<pstring, host_arena::unique_ptr<logic_family_desc_t>>;
// need to preserve order of device creation ...
- using devices_collection_type = std::vector<std::pair<pstring, owned_pool_ptr<core_device_t>>>;
- netlist_state_t(const pstring &name, plib::unique_ptr<callbacks_t> &&callbacks);
+ using devices_collection_type = std::vector<std::pair<pstring, device_arena::owned_ptr<core_device_t>>>;
+ netlist_state_t(const pstring &name, host_arena::unique_ptr<callbacks_t> &&callbacks);
PCOPYASSIGNMOVE(netlist_state_t, delete)
@@ -1659,7 +1659,7 @@ namespace netlist
std::size_t find_net_id(const detail::net_t *net) const;
template <typename T>
- void register_net(owned_pool_ptr<T> &&net) { m_nets.push_back(std::move(net)); }
+ void register_net(device_arena::owned_ptr<T> &&net) { m_nets.push_back(std::move(net)); }
/// \brief Get device pointer by name
///
@@ -1685,7 +1685,7 @@ namespace netlist
/// \param dev Device to be registered
template <typename T>
- void register_device(const pstring &name, owned_pool_ptr<T> &&dev) noexcept(false)
+ void register_device(const pstring &name, device_arena::owned_ptr<T> &&dev) noexcept(false)
{
for (auto & d : m_devices)
if (d.first == name)
@@ -1706,9 +1706,9 @@ namespace netlist
/// \param dev Device to be registered
template <typename T>
- void register_device(const pstring &name, unique_pool_ptr<T> &&dev)
+ void register_device(const pstring &name, device_arena::unique_ptr<T> &&dev)
{
- register_device(name, owned_pool_ptr<T>(dev.release(), true, dev.get_deleter()));
+ register_device(name, device_arena::owned_ptr<T>(dev.release(), true, dev.get_deleter()));
}
/// \brief Remove device
@@ -1751,13 +1751,13 @@ namespace netlist
family_collection_type &family_cache() { return m_family_cache; }
template<typename T, typename... Args>
- unique_pool_ptr<T> make_pool_object(Args&&... args)
+ device_arena::unique_ptr<T> make_pool_object(Args&&... args)
{
return m_pool.make_unique<T>(std::forward<Args>(args)...);
}
// memory pool - still needed in some places
- nlmempool &pool() noexcept { return m_pool; }
- const nlmempool &pool() const noexcept { return m_pool; }
+ device_arena &pool() noexcept { return m_pool; }
+ const device_arena &pool() const noexcept { return m_pool; }
/// \brief set extended validation mode.
///
@@ -1792,26 +1792,26 @@ namespace netlist
private:
- nlmempool m_pool; // must be deleted last!
+ device_arena m_pool; // must be deleted last!
- unique_pool_ptr<netlist_t> m_netlist;
- plib::unique_ptr<plib::dynlib_base> m_lib;
+ device_arena::unique_ptr<netlist_t> m_netlist;
+ host_arena::unique_ptr<plib::dynlib_base> m_lib;
plib::state_manager_t m_state;
- plib::unique_ptr<callbacks_t> m_callbacks;
- log_type m_log;
+ host_arena::unique_ptr<callbacks_t> m_callbacks;
+ log_type m_log;
// FIXME: should only be available during device construcion
- plib::unique_ptr<setup_t> m_setup;
+ host_arena::unique_ptr<setup_t> m_setup;
- nets_collection_type m_nets;
+ nets_collection_type m_nets;
// sole use is to manage lifetime of net objects
- devices_collection_type m_devices;
+ devices_collection_type m_devices;
// sole use is to manage lifetime of family objects
- family_collection_type m_family_cache;
- bool m_extended_validation;
+ family_collection_type m_family_cache;
+ bool m_extended_validation;
// dummy version
- int m_dummy_version;
+ int m_dummy_version;
};
namespace devices
@@ -2476,7 +2476,7 @@ namespace netlist
}
template<typename T, typename... Args>
- inline unique_pool_ptr<T> detail::netlist_object_t::make_pool_object(Args&&... args)
+ inline device_arena::unique_ptr<T> detail::netlist_object_t::make_pool_object(Args&&... args)
{
return state().make_pool_object<T>(std::forward<Args>(args)...);
}
@@ -2544,7 +2544,7 @@ namespace netlist
}
template<class O, class C, typename... Args>
- void base_device_t::create_and_register_subdevice(O &owner, const pstring &name, unique_pool_ptr<C> &dev, Args&&... args)
+ void base_device_t::create_and_register_subdevice(O &owner, const pstring &name, device_arena::unique_ptr<C> &dev, Args&&... args)
{
dev = state().make_pool_object<C>(owner, name, std::forward<Args>(args)...);
}
diff --git a/src/lib/netlist/nl_factory.cpp b/src/lib/netlist/nl_factory.cpp
index 601f6f3951d..8ef9799101a 100644
--- a/src/lib/netlist/nl_factory.cpp
+++ b/src/lib/netlist/nl_factory.cpp
@@ -42,7 +42,7 @@ namespace factory {
{
}
- void list_t::add(plib::unique_ptr<element_t> &&factory)
+ void list_t::add(host_arena::unique_ptr<element_t> &&factory)
{
for (auto & e : *this)
if (e->name() == factory->name())
@@ -74,7 +74,7 @@ namespace factory {
{
}
- unique_pool_ptr<core_device_t> library_element_t::make_device(nlmempool &pool, netlist_state_t &anetlist, const pstring &name)
+ device_arena::unique_ptr<core_device_t> library_element_t::make_device(device_arena &pool, netlist_state_t &anetlist, const pstring &name)
{
return pool.make_unique<NETLIB_NAME(wrapper)>(anetlist, name);
}
diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h
index ca9fd93b7ab..4c9a47cc749 100644
--- a/src/lib/netlist/nl_factory.h
+++ b/src/lib/netlist/nl_factory.h
@@ -27,8 +27,7 @@
NETLIB_DEVICE_IMPL_BASE(ns, chip, chip, p_name, p_def_param) \
#define NETLIB_DEVICE_IMPL_BASE(ns, p_alias, chip, p_name, p_def_param) \
- static plib::unique_ptr<factory::element_t> NETLIB_NAME(p_alias ## _c) \
- () \
+ static factory::element_t::uptr NETLIB_NAME(p_alias ## _c) () \
{ \
using devtype = factory::device_element_t<ns :: NETLIB_NAME(chip)>; \
factory::properties sl(p_def_param, PSOURCELOC()); \
@@ -92,8 +91,8 @@ namespace factory {
{
public:
- using dev_uptr = unique_pool_ptr<core_device_t>;
- using uptr = plib::unique_ptr<element_t>;
+ using dev_uptr = device_arena::unique_ptr<core_device_t>;
+ using uptr = host_arena::unique_ptr<element_t>;
using pointer = element_t *;
element_t(const pstring &name, properties &&props);
@@ -101,7 +100,7 @@ namespace factory {
PCOPYASSIGNMOVE(element_t, default)
- virtual dev_uptr make_device(nlmempool &pool,
+ virtual dev_uptr make_device(device_arena &pool,
netlist_state_t &anetlist,
const pstring &name) = 0;
@@ -126,21 +125,21 @@ namespace factory {
template <std::size_t... Is>
- dev_uptr make_device(nlmempool &pool,
+ dev_uptr make_device(device_arena &pool,
netlist_state_t &anetlist,
const pstring &name, std::tuple<Args...>& args, std::index_sequence<Is...>)
{
return pool.make_unique<C>(anetlist, name, std::forward<Args>(std::get<Is>(args))...);
}
- dev_uptr make_device(nlmempool &pool,
+ dev_uptr make_device(device_arena &pool,
netlist_state_t &anetlist,
const pstring &name, std::tuple<Args...>& args)
{
return make_device(pool, anetlist, name, args, std::index_sequence_for<Args...>{});
}
- dev_uptr make_device(nlmempool &pool,
+ dev_uptr make_device(device_arena &pool,
netlist_state_t &anetlist,
const pstring &name) override
{
@@ -150,7 +149,7 @@ namespace factory {
static uptr create(const pstring &name, properties &&props, Args&&... args)
{
- return plib::make_unique<device_element_t<C, Args...>>(name,
+ return host_arena::make_unique<device_element_t<C, Args...>>(name,
std::move(props), std::forward<Args>(args)...);
}
private:
@@ -195,7 +194,7 @@ namespace factory {
template <typename T>
element_t::uptr constructor_t(const pstring &name, properties &&props)
{
- return plib::make_unique<device_element_t<T>>(name, std::move(props));
+ return host_arena::make_unique<device_element_t<T>>(name, std::move(props));
}
// -----------------------------------------------------------------------------
@@ -208,7 +207,7 @@ namespace factory {
library_element_t(const pstring &name, properties &&props);
- dev_uptr make_device(nlmempool &pool,
+ dev_uptr make_device(device_arena &pool,
netlist_state_t &anetlist,
const pstring &name) override;
};
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 10c70b109a1..1b63b002492 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -248,7 +248,7 @@ namespace netlist
void nlparse_t::register_lib_entry(const pstring &name, factory::properties &&props)
{
- m_factory.add(plib::make_unique<factory::library_element_t>(name, std::move(props)));
+ m_factory.add(host_arena::make_unique<factory::library_element_t>(name, std::move(props)));
}
void nlparse_t::register_frontier(const pstring &attach, const pstring &r_IN,
@@ -327,7 +327,7 @@ namespace netlist
bool nlparse_t::parse_stream(plib::psource_t::stream_ptr &&istrm, const pstring &name)
{
- auto y = plib::make_unique<plib::ppreprocessor>(m_includes, &m_defines);
+ auto y = std::make_unique<plib::ppreprocessor>(m_includes, &m_defines);
y->process(std::move(istrm));
return parser_t(std::move(y), *this).parse(name);
//return parser_t(std::move(plib::ppreprocessor(&m_defines).process(std::move(istrm))), *this).parse(name);
@@ -1302,7 +1302,7 @@ public:
}
// FIXME: create proxies based on family type (far future)
- unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist,
+ device_arena::unique_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist,
const pstring &name, const logic_output_t *proxied) const override
{
switch(m_family_type)
@@ -1318,7 +1318,7 @@ public:
return anetlist.make_pool_object<devices::nld_d_to_a_proxy>(anetlist, name, proxied);
}
- unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const override
+ device_arena::unique_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const override
{
switch(m_family_type)
{
@@ -1390,7 +1390,7 @@ const logic_family_desc_t *setup_t::family_from_model(const pstring &model)
if (it != m_nlstate.family_cache().end())
return it->second.get();
- auto ret = plib::make_unique<logic_family_std_proxy_t>(ft);
+ auto ret = host_arena::make_unique<logic_family_std_proxy_t>(ft);
ret->m_low_thresh_PCNT = modv.m_IVL();
ret->m_high_thresh_PCNT = modv.m_IVH();
@@ -1414,7 +1414,7 @@ void setup_t::delete_empty_nets()
{
m_nlstate.nets().erase(
std::remove_if(m_nlstate.nets().begin(), m_nlstate.nets().end(),
- [](owned_pool_ptr<detail::net_t> &net)
+ [](device_arena::owned_ptr<detail::net_t> &net)
{
if (!net->has_connections())
{
@@ -1444,7 +1444,7 @@ void setup_t::prepare_to_run()
for (auto & e : m_abstract.m_defparams)
{
- auto param(plib::make_unique<param_str_t>(nlstate(), e.first, e.second));
+ auto param(host_arena::make_unique<param_str_t>(nlstate(), e.first, e.second));
register_param_t(*param);
m_defparam_lifetime.push_back(std::move(param));
}
@@ -1595,7 +1595,7 @@ bool source_netlist_t::parse(nlparse_t &setup, const pstring &name)
source_string_t::stream_ptr source_string_t::stream(const pstring &name)
{
plib::unused_var(name);
- auto ret(plib::make_unique<std::istringstream>(m_str));
+ auto ret(std::make_unique<std::istringstream>(m_str));
ret->imbue(std::locale::classic());
return std::move(ret); // FIXME: for c++11 clang builds
}
@@ -1603,7 +1603,7 @@ source_string_t::stream_ptr source_string_t::stream(const pstring &name)
source_mem_t::stream_ptr source_mem_t::stream(const pstring &name)
{
plib::unused_var(name);
- auto ret(plib::make_unique<std::istringstream>(m_str, std::ios_base::binary));
+ auto ret(std::make_unique<std::istringstream>(m_str, std::ios_base::binary));
ret->imbue(std::locale::classic());
return std::move(ret); // FIXME: for c++11 clang builds
}
@@ -1611,7 +1611,7 @@ source_mem_t::stream_ptr source_mem_t::stream(const pstring &name)
source_file_t::stream_ptr source_file_t::stream(const pstring &name)
{
plib::unused_var(name);
- auto ret(plib::make_unique<plib::ifstream>(plib::filesystem::u8path(m_filename)));
+ auto ret(std::make_unique<plib::ifstream>(plib::filesystem::u8path(m_filename)));
return (ret->is_open()) ? std::move(ret) : stream_ptr(nullptr);
}
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 5ca6233e8fa..9e6714007f0 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -307,7 +307,7 @@ namespace netlist
void register_param(const pstring &param, nl_fptype value);
template <typename T>
- typename std::enable_if<plib::is_floating_point<T>::value || plib::is_integral<T>::value>::type
+ std::enable_if_t<plib::is_floating_point<T>::value || plib::is_integral<T>::value>
register_param_val(const pstring &param, T value)
{
register_param(param, static_cast<nl_fptype>(value));
@@ -323,7 +323,7 @@ namespace netlist
{
static_assert(std::is_base_of<plib::psource_t, S>::value, "S must inherit from plib::psource_t");
- auto src(plib::make_unique<S>(std::forward<Args>(args)...));
+ auto src(std::make_unique<S>(std::forward<Args>(args)...));
m_sources.add_source(std::move(src));
}
@@ -351,7 +351,7 @@ namespace netlist
{
static_assert(std::is_base_of<plib::psource_t, S>::value, "S must inherit from plib::psource_t");
- auto src(plib::make_unique<S>(std::forward<Args>(args)...));
+ auto src(std::make_unique<S>(std::forward<Args>(args)...));
m_includes.add_source(std::move(src));
}
@@ -486,15 +486,15 @@ namespace netlist
models_t m_models;
// FIXME: currently only used during setup
- devices::nld_netlistparams *m_netlist_params;
+ devices::nld_netlistparams * m_netlist_params;
// FIXME: can be cleared before run
std::unordered_map<pstring, detail::core_terminal_t *> m_terminals;
- std::unordered_map<const terminal_t *, terminal_t *> m_connected_terminals;
- std::unordered_map<pstring, param_ref_t> m_params;
+ std::unordered_map<const terminal_t *, terminal_t *> m_connected_terminals;
+ std::unordered_map<pstring, param_ref_t> m_params;
std::unordered_map<const detail::core_terminal_t *,
- devices::nld_base_proxy *> m_proxies;
- std::vector<plib::unique_ptr<param_t>> m_defparam_lifetime;
+ devices::nld_base_proxy *> m_proxies;
+ std::vector<host_arena::unique_ptr<param_t>> m_defparam_lifetime;
unsigned m_proxy_cnt;
};
diff --git a/src/lib/netlist/nltypes.h b/src/lib/netlist/nltypes.h
index f7ccb9b53ec..0d34186bdc1 100644
--- a/src/lib/netlist/nltypes.h
+++ b/src/lib/netlist/nltypes.h
@@ -73,6 +73,19 @@ namespace netlist
///
using netlist_sig_t = std::uint32_t;
+ /// \brief The memory pool for netlist objects
+ ///
+ /// \note This is not the right location yet.
+ ///
+
+ using device_arena = std::conditional<NL_USE_MEMPOOL, plib::mempool_arena, plib::aligned_arena>::type;
+
+ using host_arena = plib::aligned_arena;
+
+#if 0
+ template <typename T>
+ using host_unique_ptr = host_arena::unique_ptr<T>;
+#endif
/// \brief Interface definition for netlist callbacks into calling code
///
/// A class inheriting from netlist_callbacks_t has to be passed to the netlist_t
@@ -99,7 +112,7 @@ namespace netlist
/// of a callbacks_t implementation to optionally provide such a collection
/// of symbols.
///
- virtual plib::unique_ptr<plib::dynlib_base> static_solver_lib() const;
+ virtual host_arena::unique_ptr<plib::dynlib_base> static_solver_lib() const;
};
using log_type = plib::plog_base<callbacks_t, NL_DEBUG>;
@@ -108,28 +121,6 @@ namespace netlist
// Types needed by various includes
//============================================================
- /// \brief The memory pool for netlist objects
- ///
- /// \note This is not the right location yet.
- ///
-
-#if (NL_USE_MEMPOOL)
- using nlmempool = plib::mempool_arena;
-#else
- using nlmempool = plib::aligned_arena;
-#endif
-
- /// \brief Owned pointer type for pooled allocations.
- ///
- template <typename T>
- using owned_pool_ptr = nlmempool::owned_pool_ptr<T>;
-
- /// \brief Unique pointer type for pooled allocations.
- ///
-
- template <typename T>
- using unique_pool_ptr = nlmempool::unique_pool_ptr<T>;
-
namespace detail {
/// \brief Enum specifying the type of object
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index ae8f29dec13..3d52e3af737 100644
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -38,15 +38,15 @@ namespace plib {
template <typename P, typename T>
- struct arena_deleter<P, T, typename std::enable_if<!P::has_static_deallocator>::type>
+ struct arena_deleter<P, T, std::enable_if_t<!P::has_static_deallocator>>
{
using arena_storage_type = P;
constexpr arena_deleter(arena_storage_type *a = nullptr) noexcept
: m_a(a) { }
- template<typename U, typename = typename
- std::enable_if<std::is_convertible< U*, T*>::value>::type>
+ template<typename U, typename =
+ std::enable_if_t<std::is_convertible< U*, T*>::value>>
arena_deleter(const arena_deleter<P, U> &rhs) noexcept
: m_a(rhs.m_a) { }
@@ -61,7 +61,7 @@ namespace plib {
};
template <typename P, typename T>
- struct arena_deleter<P, T, typename std::enable_if<P::has_static_deallocator>::type>
+ struct arena_deleter<P, T, std::enable_if_t<P::has_static_deallocator>>
{
using arena_storage_type = P;
@@ -296,11 +296,14 @@ namespace plib {
template <class T, size_type ALIGN = alignof(T)>
using allocator_type = arena_allocator<aligned_arena, T, ALIGN>;
+ template <class T>
+ using deleter_type = arena_deleter<aligned_arena, T>;
+
template <typename T>
- using unique_pool_ptr = std::unique_ptr<T, arena_deleter<aligned_arena, T>>;
+ using unique_ptr = std::unique_ptr<T, deleter_type<T>>;
template <typename T>
- using owned_pool_ptr = plib::owned_ptr<T, arena_deleter<aligned_arena, T>>;
+ using owned_ptr = plib::owned_ptr<T, deleter_type<T>>;
static inline aligned_arena &instance() noexcept
{
@@ -345,14 +348,14 @@ namespace plib {
}
template<typename T, typename... Args>
- unique_pool_ptr<T> make_unique(Args&&... args)
+ static inline unique_ptr<T> make_unique(Args&&... args)
{
auto *mem = allocate(alignof(T), sizeof(T));
try
{
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
auto *mema = new (mem) T(std::forward<Args>(args)...);
- return unique_pool_ptr<T>(mema, arena_deleter<aligned_arena, T>(this));
+ return unique_ptr<T>(mema, deleter_type<T>());
}
catch (...)
{
@@ -362,14 +365,14 @@ namespace plib {
}
template<typename T, typename... Args>
- owned_pool_ptr<T> make_owned(Args&&... args)
+ static inline owned_ptr<T> make_owned(Args&&... args)
{
auto *mem = allocate(alignof(T), sizeof(T));
try
{
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
auto *mema = new (mem) T(std::forward<Args>(args)...);
- return owned_pool_ptr<T>(mema, true, arena_deleter<aligned_arena, T>(*this));
+ return owned_ptr<T>(mema, true, deleter_type<T>());
}
catch (...)
{
@@ -432,15 +435,6 @@ namespace plib {
#endif
}
- template <typename T>
- using unique_ptr = aligned_arena::unique_pool_ptr<T>;
-
- template<typename T, typename... Args>
- plib::unique_ptr<T> make_unique(Args&&... args)
- {
- return aligned_arena::instance().make_unique<T>(std::forward<Args>(args)...);
- }
-
template <class T, std::size_t ALIGN = alignof(T)>
using aligned_allocator = aligned_arena::allocator_type<T, ALIGN>;
@@ -460,7 +454,7 @@ namespace plib {
};
template <typename T>
- struct align_traits<T, typename std::enable_if<has_align<T>::value, void>::type>
+ struct align_traits<T, std::enable_if_t<has_align<T>::value, void>>
{
static constexpr const std::size_t align_size = T::align_size;
static constexpr const std::size_t value_size = sizeof(typename T::value_type);
diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h
index 50ee97bc0a5..0d89a56195c 100644
--- a/src/lib/netlist/plib/parray.h
+++ b/src/lib/netlist/plib/parray.h
@@ -64,19 +64,19 @@ namespace plib {
using value_type = typename base_type::value_type;
template <int X = SIZE >
- parray(size_type size, typename std::enable_if<(X==0), int>::type = 0)
+ parray(size_type size, std::enable_if_t<(X==0), int> = 0)
: m_a(size), m_size(size)
{
}
template <int X = SIZE >
- parray(size_type size, FT val, typename std::enable_if<(X==0), int>::type = 0)
+ parray(size_type size, FT val, std::enable_if_t<(X==0), int> = 0)
: m_a(size, val), m_size(size)
{
}
template <int X = SIZE >
- parray(size_type size, typename std::enable_if<(X != 0), int>::type = 0) noexcept(false)
+ parray(size_type size, std::enable_if_t<(X != 0), int> = 0) noexcept(false)
: m_size(size)
{
if ((SIZE < 0 && size > SIZEABS())
@@ -85,7 +85,7 @@ namespace plib {
}
template <int X = SIZE >
- parray(size_type size, FT val, typename std::enable_if<(X != 0), int>::type = 0) noexcept(false)
+ parray(size_type size, FT val, std::enable_if_t<(X != 0), int> = 0) noexcept(false)
: m_size(size)
{
if ((SIZE < 0 && size > SIZEABS())
diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h
index 6710beba6c4..793c59bf954 100644
--- a/src/lib/netlist/plib/pfmtlog.h
+++ b/src/lib/netlist/plib/pfmtlog.h
@@ -203,15 +203,15 @@ namespace plib {
operator pstring() const { return m_str; }
template <typename T>
- typename std::enable_if<plib::is_floating_point<T>::value, pfmt &>::type
+ std::enable_if_t<plib::is_floating_point<T>::value, pfmt &>
f(const T &x) {return format_element('f', x); }
template <typename T>
- typename std::enable_if<plib::is_floating_point<T>::value, pfmt &>::type
+ std::enable_if_t<plib::is_floating_point<T>::value, pfmt &>
e(const T &x) {return format_element('e', x); }
template <typename T>
- typename std::enable_if<plib::is_floating_point<T>::value, pfmt &>::type
+ std::enable_if_t<plib::is_floating_point<T>::value, pfmt &>
g(const T &x) {return format_element('g', x); }
pfmt &operator ()(const void *x) {return format_element('p', x); }
@@ -241,14 +241,14 @@ namespace plib {
}
template<typename T>
- typename std::enable_if<plib::is_integral<T>::value, pfmt &>::type
+ std::enable_if_t<plib::is_integral<T>::value, pfmt &>
x(const T &x)
{
return format_element('x', x);
}
template<typename T>
- typename std::enable_if<plib::is_integral<T>::value, pfmt &>::type
+ std::enable_if_t<plib::is_integral<T>::value, pfmt &>
o(const T &x)
{
return format_element('o', x);
diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp
index b424aae7e2d..c5e011dfbb9 100644
--- a/src/lib/netlist/plib/pfunction.cpp
+++ b/src/lib/netlist/plib/pfunction.cpp
@@ -279,7 +279,7 @@ namespace plib {
}
template <typename NT>
- static inline typename std::enable_if<plib::is_floating_point<NT>::value, NT>::type
+ static inline std::enable_if_t<plib::is_floating_point<NT>::value, NT>
lfsr_random(std::uint16_t &lfsr) noexcept
{
std::uint16_t lsb = lfsr & 1;
@@ -290,7 +290,7 @@ namespace plib {
}
template <typename NT>
- static inline typename std::enable_if<plib::is_integral<NT>::value, NT>::type
+ static inline std::enable_if_t<plib::is_integral<NT>::value, NT>
lfsr_random(std::uint16_t &lfsr) noexcept
{
std::uint16_t lsb = lfsr & 1;
diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h
index 5c5f8704716..652cff059d2 100644
--- a/src/lib/netlist/plib/pmath.h
+++ b/src/lib/netlist/plib/pmath.h
@@ -97,7 +97,7 @@ namespace plib
/// \return reciprocal of argument
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
reciprocal(T v) noexcept
{
return constants<T>::one() / v;
@@ -110,7 +110,7 @@ namespace plib
/// \return absolute value of argument
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
abs(T v) noexcept
{
return std::abs(v);
@@ -123,7 +123,7 @@ namespace plib
/// \return absolute value of argument
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
sqrt(T v) noexcept
{
return std::sqrt(v);
@@ -137,7 +137,7 @@ namespace plib
/// \return sqrt(v1*v1+v2*v2)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
hypot(T v1, T v2) noexcept
{
return std::hypot(v1, v2);
@@ -150,7 +150,7 @@ namespace plib
/// \return exp(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
exp(T v) noexcept
{
return std::exp(v);
@@ -163,7 +163,7 @@ namespace plib
/// \return log(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
log(T v) noexcept
{
return std::log(v);
@@ -176,7 +176,7 @@ namespace plib
/// \return tanh(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
tanh(T v) noexcept
{
return std::tanh(v);
@@ -189,7 +189,7 @@ namespace plib
/// \return floor(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
floor(T v) noexcept
{
return std::floor(v);
@@ -202,7 +202,7 @@ namespace plib
/// \return log(1 + v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
log1p(T v) noexcept
{
return std::log1p(v);
@@ -215,7 +215,7 @@ namespace plib
/// \return sin(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
sin(T v) noexcept
{
return std::sin(v);
@@ -228,7 +228,7 @@ namespace plib
/// \return cos(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
cos(T v) noexcept
{
return std::cos(v);
@@ -241,7 +241,7 @@ namespace plib
/// \return trunc(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
trunc(T v) noexcept
{
return std::trunc(v);
@@ -255,7 +255,7 @@ namespace plib
/// \return signum(v)
///
template <typename T>
- static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
+ static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T>
signum(T v, T r = static_cast<T>(1))
{
constexpr const auto z(static_cast<T>(0));
@@ -377,7 +377,7 @@ namespace plib
///
template<typename T>
constexpr
- typename std::enable_if<plib::is_integral<T>::value && plib::is_signed<T>::value, T>::type
+ std::enable_if_t<plib::is_integral<T>::value && plib::is_signed<T>::value, T>
abs(T v) noexcept
{
return v < 0 ? -v : v;
@@ -391,7 +391,7 @@ namespace plib
///
template<typename T>
constexpr
- typename std::enable_if<plib::is_integral<T>::value && plib::is_unsigned<T>::value, T>::type
+ std::enable_if_t<plib::is_integral<T>::value && plib::is_unsigned<T>::value, T>
abs(T v) noexcept
{
return v;
diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h
index 10c1fe58f53..fca4988b639 100644
--- a/src/lib/netlist/plib/pmempool.h
+++ b/src/lib/netlist/plib/pmempool.h
@@ -39,10 +39,10 @@ namespace plib {
using allocator_type = arena_allocator<mempool_arena, T, ALIGN>;
template <typename T>
- using owned_pool_ptr = plib::owned_ptr<T, arena_deleter<mempool_arena, T>>;
+ using owned_ptr = plib::owned_ptr<T, arena_deleter<mempool_arena, T>>;
template <typename T>
- using unique_pool_ptr = std::unique_ptr<T, arena_deleter<mempool_arena, T>>;
+ using unique_ptr = std::unique_ptr<T, arena_deleter<mempool_arena, T>>;
mempool_arena(size_t min_alloc = (1<<21), size_t min_align = PALIGN_CACHELINE)
: m_min_alloc(min_alloc)
@@ -137,14 +137,14 @@ namespace plib {
}
template<typename T, typename... Args>
- owned_pool_ptr<T> make_owned(Args&&... args)
+ owned_ptr<T> make_owned(Args&&... args)
{
auto *mem = this->allocate(alignof(T), sizeof(T));
try
{
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
auto *mema = new (mem) T(std::forward<Args>(args)...);
- return owned_pool_ptr<T>(mema, true, arena_deleter<mempool_arena, T>(this));
+ return owned_ptr<T>(mema, true, arena_deleter<mempool_arena, T>(this));
}
catch (...)
{
@@ -154,14 +154,14 @@ namespace plib {
}
template<typename T, typename... Args>
- unique_pool_ptr<T> make_unique(Args&&... args)
+ unique_ptr<T> make_unique(Args&&... args)
{
auto *mem = this->allocate(alignof(T), sizeof(T));
try
{
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
auto *mema = new (mem) T(std::forward<Args>(args)...);
- return unique_pool_ptr<T>(mema, arena_deleter<mempool_arena, T>(this));
+ return unique_ptr<T>(mema, arena_deleter<mempool_arena, T>(this));
}
catch (...)
{
diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp
index d8909449403..f13d3aeef43 100644
--- a/src/lib/netlist/plib/ppreprocessor.cpp
+++ b/src/lib/netlist/plib/ppreprocessor.cpp
@@ -516,14 +516,14 @@ namespace plib {
arg = arg.substr(1, arg.length() - 2);
// first try local context
auto l(plib::util::buildpath({m_stack.back().m_local_path, arg}));
- auto lstrm(m_sources.get_stream<>(l));
+ auto lstrm(m_sources.get_stream(l));
if (lstrm)
{
m_stack.emplace_back(input_context(std::move(lstrm), plib::util::path(l), l));
}
else
{
- auto strm(m_sources.get_stream<>(arg));
+ auto strm(m_sources.get_stream(arg));
if (strm)
{
m_stack.emplace_back(input_context(std::move(strm), plib::util::path(arg), arg));
diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h
index 59e7d5006f1..d4d98c20785 100644
--- a/src/lib/netlist/plib/pstate.h
+++ b/src/lib/netlist/plib/pstate.h
@@ -194,8 +194,8 @@ protected:
private:
template<typename C>
- typename std::enable_if<plib::is_integral<C>::value || std::is_enum<C>::value
- || plib::is_floating_point<C>::value>::type
+ std::enable_if_t<plib::is_integral<C>::value || std::is_enum<C>::value
+ || plib::is_floating_point<C>::value>
save_item_dispatch(const void *owner, C &state, const pstring &stname)
{
save_state_ptr( owner, stname, dtype<C>(), 1, &state);
@@ -203,8 +203,8 @@ private:
template<typename C>
- typename std::enable_if<!(plib::is_integral<C>::value || std::is_enum<C>::value
- || plib::is_floating_point<C>::value)>::type
+ std::enable_if_t<!(plib::is_integral<C>::value || std::is_enum<C>::value
+ || plib::is_floating_point<C>::value)>
save_item_dispatch(const void *owner, C &state, const pstring &stname)
{
saver_t sav(*this, owner, stname);
diff --git a/src/lib/netlist/plib/pstonum.h b/src/lib/netlist/plib/pstonum.h
index 7336558d01a..630dee68422 100644
--- a/src/lib/netlist/plib/pstonum.h
+++ b/src/lib/netlist/plib/pstonum.h
@@ -49,7 +49,7 @@ namespace plib
struct pstonum_helper;
template<typename T>
- struct pstonum_helper<T, typename std::enable_if<plib::is_integral<T>::value && plib::is_signed<T>::value>::type>
+ struct pstonum_helper<T, std::enable_if_t<plib::is_integral<T>::value && plib::is_signed<T>::value>>
{
template <typename S>
long long operator()(std::locale loc, const S &arg, std::size_t *idx)
@@ -60,7 +60,7 @@ namespace plib
};
template<typename T>
- struct pstonum_helper<T, typename std::enable_if<plib::is_integral<T>::value && !plib::is_signed<T>::value>::type>
+ struct pstonum_helper<T, std::enable_if_t<plib::is_integral<T>::value && !plib::is_signed<T>::value>>
{
template <typename S>
unsigned long long operator()(std::locale loc, const S &arg, std::size_t *idx)
@@ -71,7 +71,7 @@ namespace plib
};
template<typename T>
- struct pstonum_helper<T, typename std::enable_if<std::is_floating_point<T>::value>::type>
+ struct pstonum_helper<T, std::enable_if_t<std::is_floating_point<T>::value>>
{
template <typename S>
long double operator()(std::locale loc, const S &arg, std::size_t *idx)
diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h
index 8c8eb70ef76..45aa8b18e83 100644
--- a/src/lib/netlist/plib/pstream.h
+++ b/src/lib/netlist/plib/pstream.h
@@ -46,7 +46,7 @@ public:
{
}
- putf8_reader(plib::unique_ptr<std::istream> &&rhs) noexcept
+ putf8_reader(std::unique_ptr<std::istream> &&rhs) noexcept
: m_strm(std::move(rhs))
{
}
@@ -104,7 +104,7 @@ public:
std::istream &stream() { return *m_strm; }
private:
- plib::unique_ptr<std::istream> m_strm;
+ std::unique_ptr<std::istream> m_strm;
putf8string m_linebuf;
};
diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h
index 57e575fdefa..622d8548bd1 100644
--- a/src/lib/netlist/plib/pstring.h
+++ b/src/lib/netlist/plib/pstring.h
@@ -103,14 +103,14 @@ public:
// mingw treats string constants as char* instead of char[N]
template<typename C,
- class = typename std::enable_if<std::is_same<C, const mem_t>::value>::type>
+ class = std::enable_if_t<std::is_same<C, const mem_t>::value>>
pstring_t(const C *string)
: m_str(string)
{
}
template<typename C, std::size_t N,
- class = typename std::enable_if<std::is_same<C, const mem_t>::value>::type>
+ class = std::enable_if_t<std::is_same<C, const mem_t>::value>>
pstring_t(C (&string)[N]) noexcept(false) // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
{
static_assert(N > 0,"pstring from array of length 0");
@@ -136,7 +136,7 @@ public:
}
template <typename T,
- class = typename std::enable_if<!std::is_same<T, pstring_t::traits_type>::value>::type>
+ class = std::enable_if_t<!std::is_same<T, pstring_t::traits_type>::value>>
explicit pstring_t(const pstring_t<T> &string)
{
m_str.clear();
@@ -148,7 +148,7 @@ public:
template <typename T,
- class = typename std::enable_if<!std::is_same<T, pstring_t::traits_type>::value>::type>
+ class = std::enable_if_t<!std::is_same<T, pstring_t::traits_type>::value>>
pstring_t &operator=(const pstring_t<T> &string)
{
m_str.clear();
diff --git a/src/lib/netlist/plib/ptime.h b/src/lib/netlist/plib/ptime.h
index 58c94641cfc..9bbd1e35671 100644
--- a/src/lib/netlist/plib/ptime.h
+++ b/src/lib/netlist/plib/ptime.h
@@ -111,7 +111,7 @@ namespace plib
}
template <typename T>
- constexpr typename std::enable_if<std::is_integral<T>::value, ptime>::type
+ constexpr std::enable_if_t<std::is_integral<T>::value, ptime>
operator/(const T &rhs) const noexcept
{
return ptime(m_time / rhs);
@@ -190,7 +190,7 @@ namespace plib
static constexpr ptime from_raw(internal_type raw) noexcept { return ptime(raw); }
template <typename FT>
- static constexpr typename std::enable_if<plib::is_floating_point<FT>::value, ptime>::type
+ static constexpr std::enable_if_t<plib::is_floating_point<FT>::value, ptime>
from_fp(FT t) noexcept { return ptime(static_cast<internal_type>(plib::floor(t * static_cast<FT>(RES) + static_cast<FT>(0.5))), RES); }
static constexpr ptime from_double(double t) noexcept
diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h
index 401cc35e262..20ea01e890e 100644
--- a/src/lib/netlist/plib/putil.h
+++ b/src/lib/netlist/plib/putil.h
@@ -15,6 +15,7 @@
#include <algorithm>
#include <initializer_list>
#include <vector>
+#include <sstream>
#define PSTRINGIFY_HELP(y) # y
#define PSTRINGIFY(x) PSTRINGIFY_HELP(x)
@@ -153,7 +154,7 @@ namespace plib
{
public:
- using stream_ptr = plib::unique_ptr<std::istream>;
+ using stream_ptr = std::unique_ptr<std::istream>;
psource_t() noexcept = default;
@@ -170,10 +171,7 @@ namespace plib
/// Will return the given string when name matches.
/// Is used in preprocessor code to eliminate inclusion of certain files.
///
- /// \tparam TS base stream class. Default is psource_t
- ///
- template <typename TS = psource_t>
- class psource_str_t : public TS
+ class psource_str_t : public psource_t
{
public:
psource_str_t(pstring name, pstring str)
@@ -183,10 +181,12 @@ namespace plib
PCOPYASSIGNMOVE(psource_str_t, delete)
~psource_str_t() noexcept override = default;
- typename TS::stream_ptr stream(const pstring &name) override
+ typename psource_t::stream_ptr stream(const pstring &name) override
{
- return (name == m_name) ?
- plib::make_unique<std::stringstream>(m_str) : typename TS::stream_ptr(nullptr);
+ if (name == m_name)
+ return std::make_unique<std::stringstream>(m_str);
+
+ return psource_t::stream_ptr(nullptr);
}
private:
pstring m_name;
@@ -195,13 +195,13 @@ namespace plib
/// \brief Generic sources collection.
///
- /// \tparam TS base stream class. Default is psource_t
+ /// \tparam ARENA memory arena, defaults to aligned_arena
///
- template <typename TS = psource_t>
+ template <typename ARENA = aligned_arena>
class psource_collection_t
{
public:
- using source_type = plib::unique_ptr<TS>;
+ using source_type = std::unique_ptr<psource_t>;
using list_t = std::vector<source_type>;
psource_collection_t() noexcept = default;
@@ -214,8 +214,8 @@ namespace plib
m_collection.push_back(std::move(src));
}
- template <typename S = TS>
- typename S::stream_ptr get_stream(pstring name)
+ template <typename S = psource_t>
+ typename psource_t::stream_ptr get_stream(pstring name)
{
for (auto &s : m_collection)
{
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index 938fe4b32ed..e267a19c60d 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -201,7 +201,7 @@ public:
stream_ptr stream(const pstring &file) override
{
pstring name = m_folder + "/" + file;
- auto strm(plib::make_unique<plib::ifstream>(plib::filesystem::u8path(name)));
+ auto strm(std::make_unique<plib::ifstream>(plib::filesystem::u8path(name)));
if (strm->fail())
return stream_ptr(nullptr);
@@ -222,17 +222,17 @@ public:
void vlog(const plib::plog_level &l, const pstring &ls) const noexcept override;
- plib::unique_ptr<plib::dynlib_base> static_solver_lib() const override
+ netlist::host_arena::unique_ptr<plib::dynlib_base> static_solver_lib() const override
{
if (m_boostlib == "builtin")
- return plib::make_unique<plib::dynlib_static>(nl_static_solver_syms);
+ return netlist::host_arena::make_unique<plib::dynlib_static>(nl_static_solver_syms);
if (m_boostlib == "generic")
- return plib::make_unique<plib::dynlib_static>(nullptr);
+ return netlist::host_arena::make_unique<plib::dynlib_static>(nullptr);
if (NL_DISABLE_DYNAMIC_LOAD)
throw netlist::nl_exception("Dynamic library loading not supported due to project security concerns.");
//pstring libpath = plib::util::environment("NL_BOOSTLIB", plib::util::buildpath({".", "nlboost.so"}));
- return plib::make_unique<plib::dynlib>(m_boostlib);
+ return netlist::host_arena::make_unique<plib::dynlib>(m_boostlib);
}
private:
@@ -245,7 +245,7 @@ class netlist_tool_t : public netlist::netlist_state_t
public:
netlist_tool_t(tool_app_t &app, const pstring &name, const pstring &boostlib)
- : netlist::netlist_state_t(name, plib::make_unique<netlist_tool_callbacks_t>(app, boostlib))
+ : netlist::netlist_state_t(name, netlist::host_arena::make_unique<netlist_tool_callbacks_t>(app, boostlib))
{
}
@@ -385,7 +385,7 @@ static std::vector<input_t> read_input(const netlist::setup_t &setup, const pstr
std::vector<input_t> ret;
if (fname != "")
{
- plib::putf8_reader r = plib::putf8_reader(plib::make_unique<plib::ifstream>(plib::filesystem::u8path(fname)));
+ plib::putf8_reader r = plib::putf8_reader(std::make_unique<plib::ifstream>(plib::filesystem::u8path(fname)));
if (r.stream().fail())
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(fname));
r.stream().imbue(std::locale::classic());
@@ -626,7 +626,7 @@ void tool_app_t::static_compile()
names.push_back(opt_name());
else
{
- plib::putf8_reader r = plib::putf8_reader(plib::make_unique<plib::ifstream>(plib::filesystem::u8path(f)));
+ plib::putf8_reader r = plib::putf8_reader(std::make_unique<plib::ifstream>(plib::filesystem::u8path(f)));
if (r.stream().fail())
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(f));
r.stream().imbue(std::locale::classic());
@@ -706,7 +706,7 @@ struct doc_ext
static doc_ext read_docsrc(const pstring &fname, const pstring &id)
{
- plib::putf8_reader r = plib::putf8_reader(plib::make_unique<plib::ifstream>(plib::filesystem::u8path(fname)));
+ plib::putf8_reader r = plib::putf8_reader(std::make_unique<plib::ifstream>(plib::filesystem::u8path(fname)));
if (r.stream().fail())
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(fname));
r.stream().imbue(std::locale::classic());
@@ -1057,7 +1057,7 @@ void tool_app_t::listdevices()
nt.parser().include("dummy");
nt.setup().prepare_to_run();
- std::vector<netlist::unique_pool_ptr<netlist::core_device_t>> devs;
+ std::vector<netlist::device_arena::unique_ptr<netlist::core_device_t>> devs;
for (auto & fl : list)
{
@@ -1123,19 +1123,19 @@ void tool_app_t::convert()
pstring result;
if (opt_type.as_string() == "spice")
{
- nl_convert_spice_t c;
+ netlist::convert::nl_convert_spice_t c;
c.convert(contents);
result = c.result();
}
else if (opt_type.as_string() == "eagle")
{
- nl_convert_eagle_t c;
+ netlist::convert::nl_convert_eagle_t c;
c.convert(contents);
result = c.result();
}
else if (opt_type.as_string() == "rinf")
{
- nl_convert_rinf_t c;
+ netlist::convert::nl_convert_rinf_t c;
c.convert(contents);
result = c.result();
}
diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp
index 291aa5b2ff7..9e3ba795554 100755
--- a/src/lib/netlist/prg/nlwav.cpp
+++ b/src/lib/netlist/prg/nlwav.cpp
@@ -27,6 +27,8 @@
// http://de.wikipedia.org/wiki/RIFF_WAVE
//
+using arena = plib::aligned_arena;
+
class wav_t
{
public:
@@ -216,7 +218,7 @@ public:
return success;
}
- void process(std::vector<plib::unique_ptr<std::istream>> &is)
+ void process(std::vector<std::unique_ptr<std::istream>> &is)
{
std::vector<plib::putf8_reader> readers;
for (auto &i : is)
@@ -644,7 +646,7 @@ private:
plib::option_example opt_ex1;
plib::option_example opt_ex2;
plib::option_example opt_ex3;
- std::vector<plib::unique_ptr<std::istream>> m_instrms;
+ std::vector<std::unique_ptr<std::istream>> m_instrms;
};
void nlwav_app::convert_wav(std::ostream &ostrm, wav_t::format fmt)
@@ -653,10 +655,10 @@ void nlwav_app::convert_wav(std::ostream &ostrm, wav_t::format fmt)
double dt = plib::reciprocal(static_cast<double>(opt_rate()));
auto nchan = m_instrms.size();
- auto wo = plib::make_unique<wavwriter>(ostrm, opt_out() != "-", fmt, nchan, opt_rate(), opt_amp());
- auto ago = plib::make_unique<aggregator>(nchan, dt, aggregator::callback_type(&wavwriter::process, wo.get()));
- auto fgo_hp = plib::make_unique<filter_hp>(opt_highpass(), opt_hpboost(), nchan, filter_hp::callback_type(&aggregator::process, ago.get()));
- auto fgo_lp = plib::make_unique<filter_lp>(opt_lowpass(), nchan, filter_lp::callback_type(&filter_hp::process, fgo_hp.get()));
+ auto wo = arena::make_unique<wavwriter>(ostrm, opt_out() != "-", fmt, nchan, opt_rate(), opt_amp());
+ auto ago = arena::make_unique<aggregator>(nchan, dt, aggregator::callback_type(&wavwriter::process, wo.get()));
+ auto fgo_hp = arena::make_unique<filter_hp>(opt_highpass(), opt_hpboost(), nchan, filter_hp::callback_type(&aggregator::process, ago.get()));
+ auto fgo_lp = arena::make_unique<filter_lp>(opt_lowpass(), nchan, filter_lp::callback_type(&filter_hp::process, fgo_hp.get()));
auto topcb = log_processor::callback_type(&filter_lp::process, fgo_lp.get());
@@ -678,7 +680,7 @@ void nlwav_app::convert_wav(std::ostream &ostrm, wav_t::format fmt)
void nlwav_app::convert_vcd(std::ostream &ostrm, vcdwriter::format_e format)
{
- plib::unique_ptr<vcdwriter> wo = plib::make_unique<vcdwriter>(ostrm, opt_args(),
+ arena::unique_ptr<vcdwriter> wo = arena::make_unique<vcdwriter>(ostrm, opt_args(),
format, opt_high(), opt_low());
log_processor::callback_type agcb = log_processor::callback_type(&vcdwriter::process, wo.get());
@@ -700,7 +702,7 @@ void nlwav_app::convert_vcd(std::ostream &ostrm, vcdwriter::format_e format)
void nlwav_app::convert_tab(std::ostream &ostrm)
{
- auto wo = plib::make_unique<tabwriter>(ostrm, opt_args(),
+ auto wo = arena::make_unique<tabwriter>(ostrm, opt_args(),
opt_start(), opt_inc(), opt_samples());
log_processor::callback_type agcb = log_processor::callback_type(&tabwriter::process, wo.get());
@@ -793,16 +795,16 @@ int nlwav_app::execute()
{
for (const auto &oi: opt_args())
{
- plib::unique_ptr<std::istream> fin;
+ std::unique_ptr<std::istream> fin;
if (oi == "-")
{
- auto temp(plib::make_unique<std::stringstream>());
+ auto temp(std::make_unique<std::stringstream>());
plib::copystream(*temp, std::cin);
fin = std::move(temp);
}
else
{
- fin = plib::make_unique<plib::ifstream>(plib::filesystem::u8path(oi), std::ios::in);
+ fin = std::make_unique<plib::ifstream>(plib::filesystem::u8path(oi), std::ios::in);
if (fin->fail())
throw plib::file_open_e(oi);
}
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index 09d210fcf55..fef3ec4a29b 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -289,7 +289,7 @@ namespace solver
private:
plib::aligned_vector<terms_for_net_t> m_rails_temp;
- std::vector<unique_pool_ptr<proxied_analog_output_t>> m_inps;
+ std::vector<device_arena::unique_ptr<proxied_analog_output_t>> m_inps;
state_var<std::size_t> m_stat_calculations;
state_var<std::size_t> m_stat_newton_raphson;
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index 2cd092cdbdd..c7e8242d83a 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -1,30 +1,6 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-// Commented out for now. Relatively low number of terminals / nets make
-// the vectorizations fast-math enables pretty expensive
-//
-#if 0
-#pragma GCC optimize "-ftree-vectorize"
-#pragma GCC optimize "-ffast-math"
-#pragma GCC optimize "-funsafe-math-optimizations"
-#pragma GCC optimize "-funroll-loops"
-#pragma GCC optimize "-funswitch-loops"
-#pragma GCC optimize "-fstrict-aliasing"
-#pragma GCC optimize "tree-vectorizer-verbose=7"
-#pragma GCC optimize "opt-info-vec"
-#pragma GCC optimize "opt-info-vec-missed"
-//#pragma GCC optimize "tree-parallelize-loops=4"
-#pragma GCC optimize "variable-expansion-in-unroller"
-#pragma GCC optimize "unsafe-loop-optimizations"
-#pragma GCC optimize "vect-cost-model"
-#pragma GCC optimize "variable-expansion-in-unroller"
-#pragma GCC optimize "tree-loop-if-convert-stores"
-#pragma GCC optimize "tree-loop-distribution"
-#pragma GCC optimize "tree-loop-im"
-#pragma GCC optimize "tree-loop-ivcanon"
-#pragma GCC optimize "ivopts"
-#endif
#include "netlist/nl_factory.h"
#include "netlist/nl_setup.h" // FIXME: only needed for splitter code
@@ -42,6 +18,7 @@
#include "plib/pomp.h"
#include <algorithm>
+#include <type_traits>
namespace netlist
{
@@ -104,16 +81,17 @@ namespace devices
}
}
+ // FIXME: should be created in device space
template <class C>
- plib::unique_ptr<solver::matrix_solver_t> create_it(netlist_state_t &nl, pstring name,
+ host_arena::unique_ptr<solver::matrix_solver_t> create_it(netlist_state_t &nl, pstring name,
analog_net_t::list_t &nets,
solver::solver_parameters_t &params, std::size_t size)
{
- return plib::make_unique<C>(nl, name, nets, &params, size);
+ return host_arena::make_unique<C>(nl, name, nets, &params, size);
}
template <typename FT, int SIZE>
- plib::unique_ptr<solver::matrix_solver_t> NETLIB_NAME(solver)::create_solver(std::size_t size,
+ host_arena::unique_ptr<solver::matrix_solver_t> NETLIB_NAME(solver)::create_solver(std::size_t size,
const pstring &solvername,
analog_net_t::list_t &nets)
{
@@ -146,11 +124,11 @@ namespace devices
return create_it<solver::matrix_solver_GCR_t<FT, SIZE>>(state(), solvername, nets, m_params, size);
#endif
}
- return plib::unique_ptr<solver::matrix_solver_t>();
+ return host_arena::unique_ptr<solver::matrix_solver_t>();
}
template <typename FT>
- plib::unique_ptr<solver::matrix_solver_t> NETLIB_NAME(solver)::create_solvers(
+ host_arena::unique_ptr<solver::matrix_solver_t> NETLIB_NAME(solver)::create_solvers(
const pstring &sname,
analog_net_t::list_t &nets)
{
@@ -158,10 +136,10 @@ namespace devices
switch (net_count)
{
case 1:
- return plib::make_unique<solver::matrix_solver_direct1_t<FT>>(state(), sname, nets, &m_params);
+ return host_arena::make_unique<solver::matrix_solver_direct1_t<FT>>(state(), sname, nets, &m_params);
break;
case 2:
- return plib::make_unique<solver::matrix_solver_direct2_t<FT>>(state(), sname, nets, &m_params);
+ return host_arena::make_unique<solver::matrix_solver_direct2_t<FT>>(state(), sname, nets, &m_params);
break;
case 3:
return create_solver<FT, 3>(3, sname, nets);
@@ -322,29 +300,23 @@ namespace devices
log().verbose("Found {1} net groups in {2} nets\n", splitter.groups.size(), state().nets().size());
for (auto & grp : splitter.groups)
{
- plib::unique_ptr<solver::matrix_solver_t> ms;
+ host_arena::unique_ptr<solver::matrix_solver_t> ms;
pstring sname = plib::pfmt("Solver_{1}")(m_mat_solvers.size());
switch (m_params.m_fp_type())
{
case solver::matrix_fp_type_e::FLOAT:
-#if (NL_USE_FLOAT_MATRIX)
- ms = create_solvers<float>(sname, grp);
-#else
- log().info("FPTYPE {1} not supported. Using DOUBLE", m_params.m_fp_type().name());
- ms = create_solvers<double>(sname, grp);
-#endif
+ if (NL_USE_FLOAT_MATRIX)
+ log().info("FPTYPE {1} not supported. Using DOUBLE", m_params.m_fp_type().name());
+ ms = create_solvers<std::conditional_t<NL_USE_FLOAT_MATRIX,float, double>>(sname, grp);
break;
case solver::matrix_fp_type_e::DOUBLE:
ms = create_solvers<double>(sname, grp);
break;
case solver::matrix_fp_type_e::LONGDOUBLE:
-#if (NL_USE_LONG_DOUBLE_MATRIX)
- ms = create_solvers<long double>(sname, grp);
-#else
- log().info("FPTYPE {1} not supported. Using DOUBLE", m_params.m_fp_type().name());
- ms = create_solvers<double>(sname, grp);
-#endif
+ if (NL_USE_LONG_DOUBLE_MATRIX)
+ log().info("FPTYPE {1} not supported. Using DOUBLE", m_params.m_fp_type().name());
+ ms = create_solvers<std::conditional_t<NL_USE_LONG_DOUBLE_MATRIX, long double, double>>(sname, grp);
break;
case solver::matrix_fp_type_e::FLOATQ128:
#if (NL_USE_FLOAT128)
diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h
index 46c335804f4..a0c28e6b302 100644
--- a/src/lib/netlist/solver/nld_solver.h
+++ b/src/lib/netlist/solver/nld_solver.h
@@ -51,18 +51,19 @@ namespace devices
logic_input_t m_fb_step;
logic_output_t m_Q_step;
- std::vector<plib::unique_ptr<solver::matrix_solver_t>> m_mat_solvers;
+ // FIXME: these should be created in device space
+ std::vector<host_arena::unique_ptr<solver::matrix_solver_t>> m_mat_solvers;
std::vector<solver::matrix_solver_t *> m_mat_solvers_all;
std::vector<solver::matrix_solver_t *> m_mat_solvers_timestepping;
solver::solver_parameters_t m_params;
template <typename FT, int SIZE>
- plib::unique_ptr<solver::matrix_solver_t> create_solver(std::size_t size,
+ host_arena::unique_ptr<solver::matrix_solver_t> create_solver(std::size_t size,
const pstring &solvername, analog_net_t::list_t &nets);
template <typename FT>
- plib::unique_ptr<solver::matrix_solver_t> create_solvers(
+ host_arena::unique_ptr<solver::matrix_solver_t> create_solvers(
const pstring &sname, analog_net_t::list_t &nets);
};
diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp
index 9ccd56301f4..393456a67f2 100644
--- a/src/lib/netlist/tools/nl_convert.cpp
+++ b/src/lib/netlist/tools/nl_convert.cpp
@@ -11,6 +11,12 @@
#include <unordered_map>
#include <vector>
+namespace netlist
+{
+
+namespace convert
+{
+
// FIXME: temporarily defined here - should be in a file
// FIXME: family logic in netlist is convoluted, create
// define a model param on core device
@@ -43,7 +49,7 @@ using lib_map_t = std::unordered_map<pstring, lib_map_entry>;
static lib_map_t read_lib_map(const pstring &lm)
{
- auto reader = plib::putf8_reader(plib::make_unique<std::istringstream>(lm));
+ auto reader = plib::putf8_reader(std::make_unique<std::istringstream>(lm));
reader.stream().imbue(std::locale::classic());
lib_map_t m;
pstring line;
@@ -106,7 +112,7 @@ nl_convert_base_t::~nl_convert_base_t()
void nl_convert_base_t::add_pin_alias(const pstring &devname, const pstring &name, const pstring &alias)
{
pstring pname = devname + "." + name;
- m_pins.emplace(pname, plib::make_unique<pin_alias_t>(pname, devname + "." + alias));
+ m_pins.emplace(pname, arena::make_unique<pin_alias_t>(pname, devname + "." + alias));
}
void nl_convert_base_t::add_ext_alias(const pstring &alias)
@@ -119,7 +125,7 @@ void nl_convert_base_t::add_ext_alias(const pstring &alias, const pstring &net)
m_ext_alias.emplace_back(alias, net);
}
-void nl_convert_base_t::add_device(plib::unique_ptr<dev_t> dev)
+void nl_convert_base_t::add_device(arena::unique_ptr<dev_t> dev)
{
for (auto & d : m_devs)
if (d->name() == dev->name())
@@ -132,15 +138,15 @@ void nl_convert_base_t::add_device(plib::unique_ptr<dev_t> dev)
void nl_convert_base_t::add_device(const pstring &atype, const pstring &aname, const pstring &amodel)
{
- add_device(plib::make_unique<dev_t>(atype, aname, amodel));
+ add_device(arena::make_unique<dev_t>(atype, aname, amodel));
}
void nl_convert_base_t::add_device(const pstring &atype, const pstring &aname, double aval)
{
- add_device(plib::make_unique<dev_t>(atype, aname, aval));
+ add_device(arena::make_unique<dev_t>(atype, aname, aval));
}
void nl_convert_base_t::add_device(const pstring &atype, const pstring &aname)
{
- add_device(plib::make_unique<dev_t>(atype, aname));
+ add_device(arena::make_unique<dev_t>(atype, aname));
}
void nl_convert_base_t::add_term(const pstring &netname, const pstring &termname)
@@ -155,7 +161,7 @@ void nl_convert_base_t::add_term(const pstring &netname, const pstring &termname
net = m_nets[netname].get();
else
{
- auto nets = plib::make_unique<net_t>(netname);
+ auto nets = arena::make_unique<net_t>(netname);
net = nets.get();
m_nets.emplace(netname, std::move(nets));
}
@@ -751,7 +757,7 @@ void nl_convert_eagle_t::tokenizer::verror(const pstring &msg)
void nl_convert_eagle_t::convert(const pstring &contents)
{
- tokenizer tok(*this, plib::putf8_reader(plib::make_unique<std::istringstream>(contents)));
+ tokenizer tok(*this, plib::putf8_reader(std::make_unique<std::istringstream>(contents)));
tok.stream().stream().imbue(std::locale::classic());
out("NETLIST_START(dummy)\n");
@@ -898,7 +904,7 @@ void nl_convert_rinf_t::tokenizer::verror(const pstring &msg)
void nl_convert_rinf_t::convert(const pstring &contents)
{
- tokenizer tok(*this, plib::putf8_reader(plib::make_unique<std::istringstream>(contents)));
+ tokenizer tok(*this, plib::putf8_reader(std::make_unique<std::istringstream>(contents)));
tok.stream().stream().imbue(std::locale::classic());
auto lm = read_lib_map(s_lib_map);
@@ -1092,3 +1098,6 @@ void nl_convert_rinf_t::convert(const pstring &contents)
}
}
+
+} // namespace convert
+} // namespace netlist
diff --git a/src/lib/netlist/tools/nl_convert.h b/src/lib/netlist/tools/nl_convert.h
index fec745b5c5e..a62a23b403f 100755
--- a/src/lib/netlist/tools/nl_convert.h
+++ b/src/lib/netlist/tools/nl_convert.h
@@ -8,6 +8,7 @@
/// \file nl_convert.h
///
+#include "plib/palloc.h"
#include "plib/pstring.h"
#include "plib/ptokenizer.h"
#include "plib/ptypes.h"
@@ -18,6 +19,14 @@
// convert - convert a spice netlist
// -------------------------------------------------
+namespace netlist
+{
+
+namespace convert
+{
+
+using arena = plib::aligned_arena;
+
class nl_convert_base_t
{
public:
@@ -155,7 +164,7 @@ private:
pstring m_alias;
};
- void add_device(plib::unique_ptr<dev_t> dev);
+ void add_device(arena::unique_ptr<dev_t> dev);
dev_t *get_device(const pstring &name)
{
for (auto &e : m_devs)
@@ -166,10 +175,10 @@ private:
std::stringstream m_buf;
- std::vector<plib::unique_ptr<dev_t>> m_devs;
- std::unordered_map<pstring, plib::unique_ptr<net_t> > m_nets;
+ std::vector<arena::unique_ptr<dev_t>> m_devs;
+ std::unordered_map<pstring, arena::unique_ptr<net_t> > m_nets;
std::vector<std::pair<pstring, pstring>> m_ext_alias;
- std::unordered_map<pstring, plib::unique_ptr<pin_alias_t>> m_pins;
+ std::unordered_map<pstring, arena::unique_ptr<pin_alias_t>> m_pins;
std::vector<unit_t> m_units;
pstring m_numberchars;
@@ -266,4 +275,7 @@ private:
};
+} // namespace convert
+} // namespace netlist
+
#endif // NL_CONVERT_H_