diff options
| author | 2019-04-16 01:49:33 +0200 | |
|---|---|---|
| committer | 2019-04-16 01:49:44 +0200 | |
| commit | e7652e14d6e52e651359e6d2bf827701aa164ba4 (patch) | |
| tree | 3e8a396a3552fdab11b2a71c6f50f939099275b4 /src/lib | |
| parent | a1ed88900c6c55e051a6c5f9cfb9711f74952e40 (diff) | |
netlist: Improve validation code.
Adjust warning levels and fix a number of topics identified.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/netlist/devices/nld_ne555.cpp | 1 | ||||
| -rw-r--r-- | src/lib/netlist/devices/nlid_proxy.cpp | 4 | ||||
| -rw-r--r-- | src/lib/netlist/nl_base.cpp | 21 | ||||
| -rw-r--r-- | src/lib/netlist/nl_base.h | 4 | ||||
| -rw-r--r-- | src/lib/netlist/nl_errstr.h | 15 | ||||
| -rw-r--r-- | src/lib/netlist/nl_setup.cpp | 17 | ||||
| -rw-r--r-- | src/lib/netlist/plib/pfmtlog.h | 2 | ||||
| -rw-r--r-- | src/lib/netlist/solver/nld_solver.cpp | 2 |
8 files changed, 51 insertions, 15 deletions
diff --git a/src/lib/netlist/devices/nld_ne555.cpp b/src/lib/netlist/devices/nld_ne555.cpp index 5e990d2e974..dc6e3e5696a 100644 --- a/src/lib/netlist/devices/nld_ne555.cpp +++ b/src/lib/netlist/devices/nld_ne555.cpp @@ -79,7 +79,6 @@ namespace netlist register_subalias("OUT", m_ROUT.m_P); // Pin 3 connect(m_R1.m_N, m_R2.m_P); - connect(m_R1.m_N, m_R2.m_P); connect(m_R2.m_N, m_R3.m_P); connect(m_RDIS.m_N, m_R3.m_N); connect(m_OUT, m_ROUT.m_N); diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp index e40d3506cff..c2eba21f648 100644 --- a/src/lib/netlist/devices/nlid_proxy.cpp +++ b/src/lib/netlist/devices/nlid_proxy.cpp @@ -104,9 +104,9 @@ namespace netlist f = true; } } - //FIXME: Use power terminals! + //FIXME: Use power terminals and change info to warning or error if (!f) - log().warning(MW_1_NO_POWER_TERMINALS_ON_DEVICE_1, out_proxied->device().name()); + log().info(MI_1_NO_POWER_TERMINALS_ON_DEVICE_1, out_proxied->device().name()); else log().verbose("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name()); } diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 43c2f6db499..5e5399c9d3a 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -1036,11 +1036,32 @@ plib::unique_ptr<plib::pistream> param_data_t::stream() return dynamic_cast<const logic_t *>(this) != nullptr; } + bool detail::core_terminal_t::is_logic_input() const NL_NOEXCEPT + { + return dynamic_cast<const logic_input_t *>(this) != nullptr; + } + + bool detail::core_terminal_t::is_logic_output() const NL_NOEXCEPT + { + return dynamic_cast<const logic_output_t *>(this) != nullptr; + } + bool detail::core_terminal_t::is_analog() const NL_NOEXCEPT { return dynamic_cast<const analog_t *>(this) != nullptr; } + bool detail::core_terminal_t::is_analog_input() const NL_NOEXCEPT + { + return dynamic_cast<const analog_input_t *>(this) != nullptr; + } + + bool detail::core_terminal_t::is_analog_output() const NL_NOEXCEPT + { + return dynamic_cast<const analog_output_t *>(this) != nullptr; + } + + bool detail::net_t::is_logic() const NL_NOEXCEPT { return dynamic_cast<const logic_net_t *>(this) != nullptr; diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index f52b720ab37..b9545f8e5af 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -565,7 +565,11 @@ namespace netlist net_t & net() noexcept { return *m_net;} bool is_logic() const NL_NOEXCEPT; + bool is_logic_input() const NL_NOEXCEPT; + bool is_logic_output() const NL_NOEXCEPT; bool is_analog() const NL_NOEXCEPT; + bool is_analog_input() const NL_NOEXCEPT; + bool is_analog_output() const NL_NOEXCEPT; bool is_state(state_e astate) const noexcept { return (m_state == astate); } state_e terminal_state() const noexcept { return m_state; } diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h index ee3c47f3339..175bbb4962e 100644 --- a/src/lib/netlist/nl_errstr.h +++ b/src/lib/netlist/nl_errstr.h @@ -41,7 +41,7 @@ #define MF_1_UNKNOWN_SOLVER_TYPE "Unknown solver type: {1}" #define MF_1_NETGROUP_SIZE_EXCEEDED_1 "Encountered netgroup with > {1} nets" -#define MW_1_NO_SPECIFIC_SOLVER "No specific solver found for netlist of size {1}" +#define MI_1_NO_SPECIFIC_SOLVER "No specific solver found for netlist of size {1}" // nl_base.cpp @@ -82,14 +82,17 @@ #define MF_2_MODEL_PARAMETERS_NOT_UPPERCASE_1_2 "model parameters should be uppercase:{1} {2}" #define MF_2_ENTITY_1_NOT_FOUND_IN_MODEL_2 "Entity {1} not found in model {2}" #define MF_1_UNKNOWN_NUMBER_FACTOR_IN_1 "Unknown number factor in: {1}" -#define MF_1_NOT_FOUND_IN_SOURCE_COLLECTION "unable to find {1} in source collection" +#define MF_1_NOT_FOUND_IN_SOURCE_COLLECTION "unable to find {1} in sources collection" #define MW_3_OVERWRITING_PARAM_1_OLD_2_NEW_3 "Overwriting {1} old <{2}> new <{3}>" #define MW_1_CONNECTING_1_TO_ITSELF "Connecting {1} to itself. This may be right, though" -#define MW_1_DUMMY_1_WITHOUT_CONNECTIONS "Found dummy terminal {1} without connections" +#define MI_1_DUMMY_1_WITHOUT_CONNECTIONS "Found dummy terminal {1} without connections" +#define MI_1_ANALOG_OUTPUT_1_WITHOUT_CONNECTIONS "Found analog output {1} without connections" +#define MI_1_LOGIC_OUTPUT_1_WITHOUT_CONNECTIONS "Found logic output {1} without connections" +#define MW_1_LOGIC_INPUT_1_WITHOUT_CONNECTIONS "Found logic input {1} without connections" #define MW_1_TERMINAL_1_WITHOUT_CONNECTIONS "Found terminal {1} without connections" -#define MW_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3 "Found device {1} connected only to railterminals {2}/{3}. Will be removed" -#define MW_1_DATA_1_NOT_FOUND "unable to find data named {1} in source collection" +#define MI_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3 "Found device {1} connected only to railterminals {2}/{3}. Will be removed" +#define MW_1_DATA_1_NOT_FOUND "unable to find data {1} in sources collection" // nld_mm5837.cpp @@ -97,7 +100,7 @@ // nlid_proxy.cpp -#define MW_1_NO_POWER_TERMINALS_ON_DEVICE_1 "D/A Proxy: Found no valid combination of power terminals on device {1}" +#define MI_1_NO_POWER_TERMINALS_ON_DEVICE_1 "D/A Proxy: Found no valid combination of power terminals on device {1}" #endif /* NL_ERRSTR_H_ */ diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 6caafa27a66..d651ae1b9f8 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -768,11 +768,20 @@ void setup_t::resolve_inputs() { detail::core_terminal_t *term = i.second; if (!term->has_net() && dynamic_cast< devices::NETLIB_NAME(dummy_input) *>(&term->device()) != nullptr) - log().warning(MW_1_DUMMY_1_WITHOUT_CONNECTIONS, term->name()); + log().info(MI_1_DUMMY_1_WITHOUT_CONNECTIONS, term->name()); else if (!term->has_net()) errstr += plib::pfmt("Found terminal {1} without a net\n")(term->name()); else if (term->net().num_cons() == 0) - log().warning(MW_1_TERMINAL_1_WITHOUT_CONNECTIONS, term->name()); + { + if (term->is_logic_input()) + log().warning(MW_1_LOGIC_INPUT_1_WITHOUT_CONNECTIONS, term->name()); + else if (term->is_logic_output()) + log().info(MI_1_LOGIC_OUTPUT_1_WITHOUT_CONNECTIONS, term->name()); + else if (term->is_analog_output()) + log().info(MI_1_ANALOG_OUTPUT_1_WITHOUT_CONNECTIONS, term->name()); + else + log().warning(MW_1_TERMINAL_1_WITHOUT_CONNECTIONS, term->name()); + } } //FIXME: error string handling if (errstr != "") @@ -1075,7 +1084,7 @@ void setup_t::prepare_to_run() // FIXME: get device name, check for device } else - log().info("Unknown parameter: {}", p.first); + log().warning("Unknown parameter: {}", p.first); } } @@ -1107,7 +1116,7 @@ void setup_t::prepare_to_run() { if (t->m_N.net().isRailNet() && t->m_P.net().isRailNet()) { - log().warning(MW_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3, + log().info(MI_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3, t->name(), t->m_N.net().name(), t->m_P.net().name()); t->m_N.net().remove_terminal(t->m_N); t->m_P.net().remove_terminal(t->m_P); diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h index cb9b59c01ce..ce94407d018 100644 --- a/src/lib/netlist/plib/pfmtlog.h +++ b/src/lib/netlist/plib/pfmtlog.h @@ -17,8 +17,8 @@ namespace plib { P_ENUM(plog_level, DEBUG, - INFO, VERBOSE, + INFO, WARNING, ERROR, FATAL) diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 4734cc3624d..63642b65e10 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -358,7 +358,7 @@ namespace devices #endif #endif default: - log().warning(MW_1_NO_SPECIFIC_SOLVER, net_count); + log().info(MI_1_NO_SPECIFIC_SOLVER, net_count); if (net_count <= 8) { ms = create_solver<double, -8>(net_count, sname); |
