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.
This commit is contained in:
couriersud 2020-07-12 12:07:35 +02:00
parent 05c8da3922
commit a5fc819f50
9 changed files with 54 additions and 18 deletions

View File

@ -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>;

View File

@ -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_ */

View File

@ -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);
}

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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")

View File

@ -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));