summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-07-12 12:07:35 +0200
committer couriersud <couriersud@gmx.org>2020-07-12 12:12:26 +0200
commita5fc819f50130a0b0af9b9366d485c79d038e8b8 (patch)
treedc20bf5a0b8be068f01b38f3794e274691f5a8a2 /src
parent05c8da39229347fe2107a8ef50296f36f4e22c28 (diff)
netlist: fix power pin names for CMOS devices.
* For truthtable cmos devices the power pin names will now be set according to the logic family. * Fix some issues for CD4538 * Change "already connected" warning to info level. Some ICs (CD4538) connect pins internally to GND and the schematics again externally. This will cause this info to be printed. The warning now is a lot more verbose.
Diffstat (limited to 'src')
-rw-r--r--src/lib/netlist/devices/nld_74123.cpp9
-rw-r--r--src/lib/netlist/devices/nld_74123.h2
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.cpp2
-rw-r--r--src/lib/netlist/examples/congo_bongo.cpp7
-rw-r--r--src/lib/netlist/macro/nlm_cd4xxx.cpp8
-rw-r--r--src/lib/netlist/macro/nlm_other.cpp8
-rw-r--r--src/lib/netlist/nl_base.h5
-rw-r--r--src/lib/netlist/nl_errstr.h5
-rw-r--r--src/lib/netlist/nl_setup.cpp26
9 files changed, 54 insertions, 18 deletions
diff --git a/src/lib/netlist/devices/nld_74123.cpp b/src/lib/netlist/devices/nld_74123.cpp
index 52003bd25cf..5033e5d5528 100644
--- a/src/lib/netlist/devices/nld_74123.cpp
+++ b/src/lib/netlist/devices/nld_74123.cpp
@@ -79,8 +79,8 @@ namespace netlist
//, m_power_pins(*this)
{
- register_subalias("GND", m_RN.N());
- register_subalias("VCC", m_RP.P());
+ register_subalias(pstring(D::gnd()), m_RN.N());
+ register_subalias(pstring(D::vcc()), m_RP.P());
register_subalias("C", m_RN.N());
register_subalias("RC", m_RN.P());
@@ -197,6 +197,9 @@ namespace netlist
return ((in[1]() | (in[2]() ^ 1)) ^ 1) & in[0](); // ((m_A() | (m_B() ^ 1)) ^ 1) & m_CLRQ()
}
template<typename T> static constexpr netlist_sig_t clear(const T &in) { return in[0]();}
+
+ static constexpr const char *vcc() { return "VCC"; }
+ static constexpr const char *gnd() { return "GND"; }
};
struct desc_74121 : public desc_74123
@@ -232,6 +235,8 @@ namespace netlist
{
return (in[1]() | (in[2]() ^ 1)); // m_A() | (m_B() ^ 1)
}
+ static constexpr const char *vcc() { return "VDD"; }
+ static constexpr const char *gnd() { return "VSS"; }
};
using NETLIB_NAME(74123) = NETLIB_NAME(74123_base)<desc_74123>;
diff --git a/src/lib/netlist/devices/nld_74123.h b/src/lib/netlist/devices/nld_74123.h
index 98e508f258d..9557b0382b6 100644
--- a/src/lib/netlist/devices/nld_74123.h
+++ b/src/lib/netlist/devices/nld_74123.h
@@ -61,6 +61,6 @@
NET_REGISTER_DEV(TTL_9602, name)
#define CD4538(name) \
- NET_REGISTER_DEV(TTL_4538, name)
+ NET_REGISTER_DEV(CD4538, name)
#endif /* NLD_74123_H_ */
diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp
index fed6327f9a8..9255e4c8c0a 100644
--- a/src/lib/netlist/devices/nlid_truthtable.cpp
+++ b/src/lib/netlist/devices/nlid_truthtable.cpp
@@ -50,7 +50,7 @@ namespace devices
, m_ign(*this, "m_ign", 0)
, m_ttp(ttp)
/* FIXME: the family should provide the names of the power-terminals! */
- , m_power_pins(*this)
+ , m_power_pins(*this, logic_family()->vcc_pin(), logic_family()->gnd_pin())
{
init(desc);
}
diff --git a/src/lib/netlist/examples/congo_bongo.cpp b/src/lib/netlist/examples/congo_bongo.cpp
index 3b9dc8b33a5..32119dc2a51 100644
--- a/src/lib/netlist/examples/congo_bongo.cpp
+++ b/src/lib/netlist/examples/congo_bongo.cpp
@@ -84,6 +84,7 @@ NETLIST_START(congo_bongo)
NET_C(R94.1, SJ1)
NET_C(SOU1, amp.AMPIN1)
+ NET_C(GND, amp.GND)
#if USE_OPTIMIZATIONS
/* The opamp has an UGF of about 1000k. This doesn't work here and causes oscillations.
@@ -366,7 +367,8 @@ NETLIST_START(CongoBongo_amp)
ALIAS(AMPIN1, R83.1)
ALIAS(AMPOUT1, R77.1)
ANALOG_INPUT(I_V12, 12)
- ANALOG_INPUT(GND, 0)
+ //ANALOG_INPUT(GND, 0)
+ ALIAS(GND, C66.2)
CAP(C124, CAP_U(470))
CAP(C51, CAP_U(10))
CAP(C53, CAP_U(200))
@@ -404,7 +406,8 @@ NETLIST_START(CongoBongo_amp)
NET_C(R77.2, C53.1)
NET_C(C66.1, U2.4, C124.1, R89.1, I_V12.Q)
NET_C(R83.1, R91.1)
- NET_C(GND, C66.2, U2.11, C124.2, C56.2, C55.2, C57.2, C59.2, R90.2, C53.2, XVR1.3)
+ //NET_C(GND, C66.2, U2.11, C124.2, C56.2, C55.2, C57.2, C59.2, R90.2, C53.2, XVR1.3)
+ NET_C(GND, U2.11, C124.2, C56.2, C55.2, C57.2, C59.2, R90.2, C53.2, XVR1.3)
NET_C(R83.2, U2.13, U2.14, R86.1)
NET_C(U2.1, R88.1, C51.1)
NET_C(U2.7, R85.1, R87.2)
diff --git a/src/lib/netlist/macro/nlm_cd4xxx.cpp b/src/lib/netlist/macro/nlm_cd4xxx.cpp
index c5dfe1e9ef5..1db02040006 100644
--- a/src/lib/netlist/macro/nlm_cd4xxx.cpp
+++ b/src/lib/netlist/macro/nlm_cd4xxx.cpp
@@ -292,7 +292,7 @@ static NETLIST_START(CD4538_DIP)
ALIAS(5, A.B)
ALIAS(6, A.Q)
ALIAS(7, A.QQ)
- ALIAS(8, A.C)
+ ALIAS(8, A.VSS)
ALIAS(9, B.QQ)
ALIAS(10, B.Q)
@@ -301,10 +301,10 @@ static NETLIST_START(CD4538_DIP)
ALIAS(13, B.CLRQ)
ALIAS(14, B.RC) // RC2
ALIAS(15, B.C) // C2
- ALIAS(16, A.RP.1)
+ ALIAS(16, A.VDD)
- NET_C(A.VCC, B.VCC)
- NET_C(A.GND, B.GND)
+ NET_C(A.VDD, B.VDD)
+ NET_C(A.VSS, B.VSS)
NETLIST_END()
diff --git a/src/lib/netlist/macro/nlm_other.cpp b/src/lib/netlist/macro/nlm_other.cpp
index 0953da96469..327b57faa62 100644
--- a/src/lib/netlist/macro/nlm_other.cpp
+++ b/src/lib/netlist/macro/nlm_other.cpp
@@ -27,16 +27,16 @@ static NETLIST_START(MC14584B_DIP)
MC14584B_GATE(E)
MC14584B_GATE(F)
- NET_C(A.VCC, B.VCC, C.VCC, D.VCC, E.VCC, F.VCC)
- NET_C(A.GND, B.GND, C.GND, D.GND, E.GND, F.GND)
+ NET_C(A.VDD, B.VDD, C.VDD, D.VDD, E.VDD, F.VDD)
+ NET_C(A.VSS, B.VSS, C.VSS, D.VSS, E.VSS, F.VSS)
DIPPINS( /* +--------------+ */
- A.A, /* A1 |1 ++ 14| VCC */ A.VCC,
+ A.A, /* A1 |1 ++ 14| VDD */ A.VDD,
A.Q, /* Y1 |2 13| A6 */ F.A,
B.A, /* A2 |3 12| Y6 */ F.Q,
B.Q, /* Y2 |4 MC14584B 11| A5 */ E.A,
C.A, /* A3 |5 10| Y5 */ E.Q,
C.Q, /* Y3 |6 9| A4 */ D.A,
- A.GND,/* GND |7 8| Y4 */ D.Q
+ A.VSS,/* VSS |7 8| Y4 */ D.Q
/* +--------------+ */
)
NETLIST_END()
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 96f461b8ae5..912d733c882 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -274,12 +274,17 @@ namespace netlist
bool is_below_low_thresh_V(nl_fptype V, nl_fptype VN, nl_fptype VP) const noexcept
{ return V < low_thresh_V(VN, VP); }
+ pstring vcc_pin() const { return pstring(m_vcc); }
+ pstring gnd_pin() const { return pstring(m_gnd); }
+
nl_fptype m_low_thresh_PCNT; //!< low input threshhold offset. If the input voltage is below this value times supply voltage, a "0" input is signalled
nl_fptype m_high_thresh_PCNT; //!< high input threshhold offset. If the input voltage is above the value times supply voltage, a "0" input is signalled
nl_fptype m_low_VO; //!< low output voltage offset. This voltage is output if the ouput is "0"
nl_fptype m_high_VO; //!< high output voltage offset. The supply voltage minus this offset is output if the ouput is "1"
nl_fptype m_R_low; //!< low output resistance. Value of series resistor used for low output
nl_fptype m_R_high; //!< high output resistance. Value of series resistor used for high output
+ const char *m_vcc; //!< default power pin name for positive supply
+ const char *m_gnd; //!< default power pin name for negative supply
};
/// \brief Base class for devices, terminals, outputs and inputs which support
diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h
index 8fd5f58f8e3..8287f5cf5b1 100644
--- a/src/lib/netlist/nl_errstr.h
+++ b/src/lib/netlist/nl_errstr.h
@@ -92,7 +92,10 @@ namespace netlist
PERRMSGV(MI_OVERWRITING_PARAM_1_OLD_2_NEW_3, 3, "Overwriting {1} old <{2}> new <{3}>")
PERRMSGV(MW_CONNECTING_1_TO_ITSELF, 1, "Connecting net {1} to itself.")
- PERRMSGV(MW_CONNECTING_1_TO_2_SAME_NET, 3, "Connecting terminals {1} and {2} which are already both on net {3}")
+ PERRMSGV(MI_CONNECTING_1_TO_2_SAME_NET, 3, "Connecting terminals {1} and {2} which are already both on net {3}. "
+ "It is ok if you read this warning and it relates to pin which is connected internally to GND and the schematics "
+ "show an external connection as well. Onde example is the CD4538. In other cases this warning may indicate "
+ "an error in your netlist.")
PERRMSGV(ME_NC_PIN_1_WITH_CONNECTIONS, 1, "Found NC (not connected) terminal {1} with connections")
PERRMSGV(MI_ANALOG_OUTPUT_1_WITHOUT_CONNECTIONS,1, "Found analog output {1} without connections")
PERRMSGV(MI_LOGIC_OUTPUT_1_WITHOUT_CONNECTIONS, 1, "Found logic output {1} without connections")
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 1c9b802ddbc..ae158c90136 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -868,9 +868,13 @@ void setup_t::connect_terminal_output(terminal_t &in, detail::core_terminal_t &o
// no proxy needed, just merge existing terminal net
if (in.has_net())
{
- if (&out.net() == &in.net())
- log().warning(MW_CONNECTING_1_TO_2_SAME_NET(in.name(), out.name(), in.net().name()));
- merge_nets(out.net(), in.net());
+ if (&out.net() != &in.net())
+ merge_nets(out.net(), in.net());
+ else
+ // Only an info - some ICs (CD4538) connect pins internally to GND
+ // and the schematics again externally. This will cause this warning.
+ // FIXME: Add a hint to suppress the warning.
+ log().info(MI_CONNECTING_1_TO_2_SAME_NET(in.name(), out.name(), in.net().name()));
}
else
add_terminal(out.net(), in);
@@ -1447,6 +1451,22 @@ const logic_family_desc_t *setup_t::family_from_model(const pstring &model)
ret->m_R_low = modv.m_ORL();
ret->m_R_high = modv.m_ORH();
+ switch (ft)
+ {
+ case family_type::CUSTOM:
+ case family_type::TTL:
+ ret->m_vcc = "VCC";
+ ret->m_gnd = "GND";
+ break;
+ case family_type::MOS:
+ case family_type::CMOS:
+ case family_type::NMOS:
+ case family_type::PMOS:
+ ret->m_vcc = "VDD";
+ ret->m_gnd = "VSS";
+ break;
+ }
+
auto *retp = ret.get();
m_nlstate.family_cache().emplace(model, std::move(ret));