summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2017-04-09 13:24:12 +0200
committer couriersud <couriersud@gmx.org>2017-04-09 23:00:02 +0200
commitf011567c77896f657e3c802b2fb6d9ccaad00a12 (patch)
treefb14f331636c233a8dc96aea149e46d9c64b18b9 /src/lib/netlist
parentcfa43e6ae554920d99f307a7959e2a656e3dfa70 (diff)
Parametrized device activation in truthtables. (nw)
Diffstat (limited to 'src/lib/netlist')
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/lib/netlist/devices/nlid_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h
index 84f49f7c305..92e1b6d49ed 100644
--- a/src/lib/netlist/devices/nlid_truthtable.h
+++ b/src/lib/netlist/devices/nlid_truthtable.h
@@ -67,9 +67,10 @@ namespace netlist
typedef typename uint_for_size<need_bytes_for_bits<m_NO + m_NI>::value>::type type_t;
- static constexpr std::size_t m_num_bits = m_NI;
- static constexpr std::size_t m_size = (1 << (m_num_bits));
- static constexpr type_t m_outmask = ((1 << m_NO) - 1);
+ static constexpr const std::size_t m_num_bits = m_NI;
+ static constexpr const std::size_t m_size = (1 << (m_num_bits));
+ static constexpr const type_t m_outmask = ((1 << m_NO) - 1);
+ static constexpr const std::size_t m_min_devices_for_deactivate = 2;
struct truthtable_t
{
@@ -115,7 +116,7 @@ namespace netlist
void inc_active() NL_NOEXCEPT override
{
- if (m_NI > 1)
+ if (m_NI >= m_min_devices_for_deactivate)
if (++m_active == 1)
{
process<false>();
@@ -130,7 +131,7 @@ namespace netlist
* can decide for each individual gate whether it is beneficial to
* ignore deactivation.
*/
- if (m_NI > 1)
+ if (m_NI >= m_min_devices_for_deactivate)
if (--m_active == 0)
{
for (std::size_t i = 0; i< m_NI; i++)
@@ -152,7 +153,7 @@ namespace netlist
netlist_time mt(netlist_time::zero());
type_t nstate(0);
- if (m_NI > 1)
+ if (m_NI >= m_min_devices_for_deactivate)
{
type_t ign(m_ign);
if (!doOUT)
@@ -174,13 +175,14 @@ namespace netlist
else
{
if (!doOUT)
- {
- nstate |= m_I[0]();
- //mt = std::max(this->m_I[0].net().time(), mt);
- mt = this->m_I[0].net().time();
- }
+ for (std::size_t i = 0; i < m_NI; i++)
+ {
+ nstate |= (m_I[i]() << i);
+ mt = std::max(this->m_I[i].net().time(), mt);
+ }
else
- nstate |= m_I[0]();
+ for (std::size_t i = 0; i < m_NI; i++)
+ nstate |= (m_I[i]() << i);
}
const type_t outstate(m_ttp.m_outs[nstate]);
@@ -199,7 +201,7 @@ namespace netlist
for (std::size_t i = 0; i < m_NO; out >>= 1, ++i)
m_Q[i].set_Q_time(out & 1, mt + tim[t[i]]);
- if (m_NI > 1)
+ if (m_NI >= m_min_devices_for_deactivate)
{
type_t ign(m_ign);
for (auto I = m_I.begin(); ign != 0; ign >>= 1, ++I)