diff options
author | 2020-01-27 21:47:41 +0100 | |
---|---|---|
committer | 2020-01-27 21:47:41 +0100 | |
commit | f7d8a10da53e07747ab4f11d5c7b4827869e5763 (patch) | |
tree | 1ae8c2b3a06a6abd253814bd159cb151dd6cc20a | |
parent | 8c2bb6236774977e848c62fad35eb665a6d8e58b (diff) |
netlist: Code maintenance. (nw)
- Fixed some clang lint warnings
- Removed dead code
- Experimental parser code to allow calculations in parameter value.
This already works for compiled netlists. These changes are
currently disabled. Updated pong netlist (and CRC/SHA) to work
with this new code.
26 files changed, 148 insertions, 73 deletions
diff --git a/src/lib/netlist/analog/nld_mosfet.cpp b/src/lib/netlist/analog/nld_mosfet.cpp index fff7b8d03eb..4817f6cc00c 100644 --- a/src/lib/netlist/analog/nld_mosfet.cpp +++ b/src/lib/netlist/analog/nld_mosfet.cpp @@ -476,7 +476,11 @@ namespace analog const nl_fptype Vctrl = (is_forward ? Vgs : Vgd) - Vth; - nl_fptype Ids(0), gm(0), gds(0), gmb(0); + nl_fptype Ids(0); + nl_fptype gm(0); + nl_fptype gds(0); + nl_fptype gmb(0); + const nl_fptype absVds = plib::abs(Vds); if (Vctrl <= nlconst::zero()) diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp index e575e5a8b3b..b213faea082 100644 --- a/src/lib/netlist/devices/nlid_truthtable.cpp +++ b/src/lib/netlist/devices/nlid_truthtable.cpp @@ -162,7 +162,7 @@ namespace devices void parseline(unsigned cur, std::vector<pstring> list, tt_bitset state, std::uint_least64_t val, std::vector<uint_least8_t> &timing_index); - tt_bitset calculate_ignored_inputs(tt_bitset i) const; + tt_bitset calculate_ignored_inputs(tt_bitset state) const; unsigned m_NO; unsigned m_NI; diff --git a/src/lib/netlist/macro/nlm_base.cpp b/src/lib/netlist/macro/nlm_base.cpp index 79a6a358fa7..e04d98e59ad 100644 --- a/src/lib/netlist/macro/nlm_base.cpp +++ b/src/lib/netlist/macro/nlm_base.cpp @@ -75,11 +75,11 @@ NETLIST_END() * ---------------------------------------------------------------------------*/ static NETLIST_START(family_models) - NET_MODEL("FAMILY _(TYPE=CUSTOM FV=5 IVL=0.16 IVH=0.4 OVL=0.1 OVH=1.0 ORL=1.0 ORH=130.0)") + NET_MODEL("FAMILY _(TYPE=CUSTOM IVL=0.16 IVH=0.4 OVL=0.1 OVH=1.0 ORL=1.0 ORH=130.0)") NET_MODEL("OPAMP _()") NET_MODEL("SCHMITT_TRIGGER _()") - NET_MODEL("74XXOC FAMILY(FV=5 IVL=0.16 IVH=0.4 OVL=0.1 OVH=0.05 ORL=10.0 ORH=1.0e8)") + NET_MODEL("74XXOC FAMILY(IVL=0.16 IVH=0.4 OVL=0.1 OVH=0.05 ORL=10.0 ORH=1.0e8)") NET_MODEL("74XX FAMILY(TYPE=TTL)") NET_MODEL("CD4XXX FAMILY(TYPE=CD4XXX)") NETLIST_END() diff --git a/src/lib/netlist/macro/nlm_other.cpp b/src/lib/netlist/macro/nlm_other.cpp index befbc99a364..873f3ad84c5 100644 --- a/src/lib/netlist/macro/nlm_other.cpp +++ b/src/lib/netlist/macro/nlm_other.cpp @@ -48,7 +48,7 @@ NETLIST_START(otheric_lib) TT_LINE(" 0 | 1 |100") TT_LINE(" 1 | 0 |100") // 2.1V negative going and 2.7V positive going at 5V - TT_FAMILY("FAMILY(FV=0 IVL=0.42 IVH=0.54 OVL=0.05 OVH=0.05 ORL=10.0 ORH=10.0)") + TT_FAMILY("FAMILY(IVL=0.42 IVH=0.54 OVL=0.05 OVH=0.05 ORL=10.0 ORH=10.0)") TRUTHTABLE_END() LOCAL_LIB_ENTRY(MC14584B_DIP) diff --git a/src/lib/netlist/macro/nlm_ttl74xx.cpp b/src/lib/netlist/macro/nlm_ttl74xx.cpp index 9e0fa15c582..e96c32f66cf 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx.cpp +++ b/src/lib/netlist/macro/nlm_ttl74xx.cpp @@ -897,7 +897,7 @@ NETLIST_START(TTL74XX_lib) NET_MODEL("DM7414 SCHMITT_TRIGGER(VTP=1.7 VTM=0.9 VI=4.35 RI=6.15k VOH=3.5 ROH=120 VOL=0.1 ROL=37.5 TPLH=15 TPHL=15)") NET_MODEL("TTL_7414_GATE SCHMITT_TRIGGER(VTP=1.7 VTM=0.9 VI=4.35 RI=6.15k VOH=3.5 ROH=120 VOL=0.1 ROL=37.5 TPLH=15 TPHL=15)") NET_MODEL("DM74LS14 SCHMITT_TRIGGER(VTP=1.6 VTM=0.8 VI=4.4 RI=19.3k VOH=3.45 ROH=130 VOL=0.1 ROL=31.2 TPLH=15 TPHL=15)") - //NET_MODEL("DM7414 FAMILY(FV=5 IVL=0.16 IVH=0.4 OVL=0.1 OVH=0.05 ORL=10.0 ORH=1.0e8)") + //NET_MODEL("DM7414 FAMILY(IVL=0.16 IVH=0.4 OVL=0.1 OVH=0.05 ORL=10.0 ORH=1.0e8)") TRUTHTABLE_START(TTL_7400_GATE, 2, 1, "") diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 14bb0e5530b..147c7b0423e 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -35,7 +35,6 @@ namespace netlist public: logic_family_ttl_t() : logic_family_desc_t() { - m_fixed_V = nlconst::magic(5.0); m_low_thresh_PCNT = nlconst::magic(0.8 / 5.0); m_high_thresh_PCNT = nlconst::magic(2.0 / 5.0); // m_low_V - these depend on sinked/sourced current. Values should be suitable for typical applications. @@ -62,7 +61,6 @@ namespace netlist public: logic_family_cd4xxx_t() : logic_family_desc_t() { - m_fixed_V = nlconst::magic(0.0); m_low_thresh_PCNT = nlconst::magic(1.5 / 5.0); m_high_thresh_PCNT = nlconst::magic(3.5 / 5.0); // m_low_V - these depend on sinked/sourced current. Values should be suitable for typical applications. @@ -214,6 +212,24 @@ namespace netlist // Initialize factory devices::initialize_factory(m_setup->factory()); + + // Add default include file + using a = plib::psource_str_t<plib::psource_t>; +#if USE_EVAL + const pstring content = + "#define RES_R(res) (res) \n" + "#define RES_K(res) ((res) * 1e3) \n" + "#define RES_M(res) ((res) * 1e6) \n" + "#define CAP_U(cap) ((cap) * 1e-6) \n" + "#define CAP_N(cap) ((cap) * 1e-9) \n" + "#define CAP_P(cap) ((cap) * 1e-12) \n" + "#define IND_U(ind) ((ind) * 1e-6) \n" + "#define IND_N(ind) ((ind) * 1e-9) \n" + "#define IND_P(ind) ((ind) * 1e-12) \n"; + setup().add_include(plib::make_unique<a>("netlist/devices/net_lib.h", content)); +#else + setup().add_include(plib::make_unique<a>("netlist/devices/net_lib.h","")); +#endif NETLIST_NAME(base)(*m_setup); } diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 95540a7d29a..0f8feea9faf 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -265,8 +265,6 @@ namespace netlist virtual unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *proxied) const = 0; - // FIXME: remove fixed_V() - nl_fptype fixed_V() const noexcept{return m_fixed_V; } nl_fptype low_thresh_V(nl_fptype VN, nl_fptype VP) const noexcept{ return VN + (VP - VN) * m_low_thresh_PCNT; } nl_fptype high_thresh_V(nl_fptype VN, nl_fptype VP) const noexcept{ return VN + (VP - VN) * m_high_thresh_PCNT; } nl_fptype low_offset_V() const noexcept{ return m_low_VO; } @@ -280,7 +278,6 @@ namespace netlist bool is_below_low_thresh_V(nl_fptype V, nl_fptype VN, nl_fptype VP) const noexcept { return (V - VN) < low_thresh_V(VN, VP); } - nl_fptype m_fixed_V; //!< For variable voltage families, specify 0. For TTL this would be 5. 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" diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h index f6b594af977..fa001d22836 100644 --- a/src/lib/netlist/nl_config.h +++ b/src/lib/netlist/nl_config.h @@ -10,6 +10,9 @@ #include "plib/pconfig.h" #include "plib/pexception.h" +// FIXME: Remove this again after testing +#define USE_EVAL (0) + /// /// \brief Version - Major. /// diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp index d1156117f8e..7f4d7bd4e7e 100644 --- a/src/lib/netlist/nl_parser.cpp +++ b/src/lib/netlist/nl_parser.cpp @@ -236,10 +236,12 @@ void parser_t::frontier() // don't do much pstring attachat = get_identifier(); require_token(m_tok_comma); - nl_fptype r_IN = eval_param(get_token()); - require_token(m_tok_comma); - nl_fptype r_OUT = eval_param(get_token()); - require_token(m_tok_paren_right); + auto tok = get_token(); + nl_fptype r_IN = eval_param(tok); + require_token(tok, m_tok_comma); + tok = get_token(); + nl_fptype r_OUT = eval_param(tok); + require_token(tok, m_tok_paren_right); m_setup.register_frontier(attachat, r_IN, r_OUT); } @@ -335,14 +337,15 @@ void parser_t::netdev_param() { m_setup.log().debug("Parser: Param: {1} {2}\n", param, tok.str()); m_setup.register_param(param, tok.str()); + require_token(m_tok_paren_right); } else { nl_fptype val = eval_param(tok); m_setup.log().debug("Parser: Param: {1} {2}\n", param, val); m_setup.register_param(param, val); + require_token(tok, m_tok_paren_right); } - require_token(m_tok_paren_right); } void parser_t::netdev_hint() @@ -370,7 +373,10 @@ void parser_t::device(const pstring &dev_type) { tok = get_token(); if (tok.is_type(token_type::IDENTIFIER) || tok.is_type(token_type::STRING)) + { params.push_back(tok.str()); + tok = get_token(); + } else { // FIXME: Do we really need this? @@ -381,7 +387,6 @@ void parser_t::device(const pstring &dev_type) else params.push_back(plib::pfmt("{1}")(static_cast<long>(value))); } - tok = get_token(); } require_token(tok, m_tok_paren_right); @@ -393,9 +398,32 @@ void parser_t::device(const pstring &dev_type) // private // ---------------------------------------------------------------------------------------- -nl_fptype parser_t::eval_param(const token_t &tok) +nl_fptype parser_t::eval_param(token_t &tok) { +#if USE_EVAL + int pc(0); + pstring ret; + while (!tok.is(m_tok_comma)) + { + if (tok.is(m_tok_paren_left)) + pc++; + else if (tok.is(m_tok_paren_right)) + { + if (pc<=0) + break; + pc--; + } + ret += tok.str(); + tok = get_token(); + } + // FIXME: Not necessary here, should be done if parameter is read by devices + plib::pfunction<nl_fptype> func; + func.compile_infix(ret, {}); + return func.evaluate(); + +#else static std::array<pstring, 7> macs = {"", "RES_R", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"}; + static std::array<nl_fptype, 7> facs = { nlconst::magic(1.0), nlconst::magic(1.0), @@ -424,8 +452,9 @@ nl_fptype parser_t::eval_param(const token_t &tok) if (err) error(MF_PARAM_NOT_FP_1(tok.str())); } + tok = get_token(); return ret * facs[f]; - +#endif } } // namespace netlist diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h index e747f2dac28..46ce30b0370 100644 --- a/src/lib/netlist/nl_parser.h +++ b/src/lib/netlist/nl_parser.h @@ -44,7 +44,7 @@ namespace netlist void verror(const pstring &msg) override; private: - nl_fptype eval_param(const token_t &tok); + nl_fptype eval_param(token_t &tok); token_id_t m_tok_paren_left; token_id_t m_tok_paren_right; diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index dad4684e2eb..59b45fbdede 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -1150,7 +1150,6 @@ const logic_family_desc_t *setup_t::family_from_model(const pstring &model) auto ret = plib::make_unique<logic_family_std_proxy_t>(); - ret->m_fixed_V = m_models.value(model, "FV"); ret->m_low_thresh_PCNT = m_models.value(model, "IVL"); ret->m_high_thresh_PCNT = m_models.value(model, "IVH"); ret->m_low_VO = m_models.value(model, "OVL"); diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index c1269e3752c..035fbdb749d 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -367,8 +367,8 @@ namespace plib { return true; } - size_type cur_alloc() const noexcept { return m_stat_cur_alloc(); } - size_type max_alloc() const noexcept { return m_stat_max_alloc(); } + size_type cur_alloc() const noexcept { return m_stat_cur_alloc(); } // NOLINT(readability-convert-member-functions-to-static) + size_type max_alloc() const noexcept { return m_stat_max_alloc(); } // NOLINT(readability-convert-member-functions-to-static) private: static size_t &m_stat_cur_alloc() noexcept { static size_t val = 0; return val; } static size_t &m_stat_max_alloc() noexcept { static size_t val = 0; return val; } diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h index 4fd928ddb54..e995c3a6c27 100644 --- a/src/lib/netlist/plib/pmath.h +++ b/src/lib/netlist/plib/pmath.h @@ -76,7 +76,7 @@ namespace plib /// later. /// template <typename V> - static inline constexpr const T magic(V &&v) noexcept { return static_cast<T>(v); } + static inline constexpr T magic(V &&v) noexcept { return static_cast<T>(v); } }; /// \brief typesafe reciprocal function @@ -415,7 +415,7 @@ namespace plib return (m != 0 && n != 0) ? (plib::abs(m) / gcd(m, n)) * plib::abs(n) : 0; } - static_assert(noexcept(constants<double>::one()) == true, "Not evaluated as constexpr"); + static_assert(noexcept(constants<double>::one()), "Not evaluated as constexpr"); } // namespace plib diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp index f98a57cb921..e2058a5b5ad 100644 --- a/src/lib/netlist/plib/ppreprocessor.cpp +++ b/src/lib/netlist/plib/ppreprocessor.cpp @@ -56,7 +56,7 @@ namespace plib { pstring e = plib::pfmt("{1}:{2}:0: error: {3}\n") (m_stack.back().m_name, m_stack.back().m_lineno, err); m_stack.pop_back(); - while (m_stack.size() > 0) + while (!m_stack.empty()) { if (m_stack.size() == 1) trail = trail_first; @@ -236,38 +236,51 @@ namespace plib { tmpret.push_back(s); } else - if (!remove_ws || (tmp[pi] != " " && tmp[pi] != "\t")) - tmpret.push_back(tmp[pi]); + { + pstring tok=tmp[pi]; + if (tok.size() >= 2 && pi < tmp.size() - 2 ) + { + auto sc=tok.substr(0,1); + auto ec=tok.substr(tok.size()-1, 1); + if ((sc == "." || (sc>="0" && sc<="9")) && (ec=="e" || ec=="E")) + { + // looks like an incomplete float due splitting by - or + + tok = tok + tmp[pi+1] + tmp[pi+2]; + pi += 2; + } + } + if (!remove_ws || (tok != " " && tok != "\t")) + tmpret.push_back(tok); + } pi++; } + if (!concat) return tmpret; - else + + // FIXME: error if concat at beginning or end + string_list ret; + pi = 0; + while (pi<tmpret.size()) { - // FIXME: error if concat at beginning or end - string_list ret; - pi = 0; - while (pi<tmpret.size()) + if (tmpret[pi] == "##") { - if (tmpret[pi] == "##") - { - while (ret.back() == " " || ret.back() == "\t") - ret.pop_back(); - pstring cc = ret.back(); + while (ret.back() == " " || ret.back() == "\t") ret.pop_back(); - pi++; - while (pi < tmpret.size() && (tmpret[pi] == " " || tmpret[pi] == "\t")) - pi++; - if (pi == tmpret.size()) - error("## found at end of sequence"); - ret.push_back(cc + tmpret[pi]); - } - else - ret.push_back(tmpret[pi]); + pstring cc = ret.back(); + ret.pop_back(); pi++; + while (pi < tmpret.size() && (tmpret[pi] == " " || tmpret[pi] == "\t")) + pi++; + if (pi == tmpret.size()) + error("## found at end of sequence"); + ret.push_back(cc + tmpret[pi]); } - return ret; + else + ret.push_back(tmpret[pi]); + pi++; } + return ret; } bool ppreprocessor::is_valid_token(const pstring &str) diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index ba09f342838..a7b18cd7e17 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -29,9 +29,9 @@ int pstring_t<F>::compare(const pstring_t &right) const noexcept if (si != this->end() && ri != right.end()) return static_cast<int>(*si) - static_cast<int>(*ri); - else if (this->mem_t_size() > right.mem_t_size()) + if (this->mem_t_size() > right.mem_t_size()) return 1; - else if (this->mem_t_size() < right.mem_t_size()) + if (this->mem_t_size() < right.mem_t_size()) return -1; return 0; } diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h index 29f8fe2e6da..86b041cadaf 100644 --- a/src/lib/netlist/plib/pstring.h +++ b/src/lib/netlist/plib/pstring.h @@ -186,8 +186,8 @@ public: pstring_t& operator+=(const pstring_t &string) { m_str.append(string.m_str); return *this; } pstring_t& operator+=(const code_t c) { traits_type::encode(c, m_str); return *this; } friend pstring_t operator+(const pstring_t &lhs, const pstring_t &rhs) { return pstring_t(lhs) += rhs; } - friend pstring_t operator+(const pstring_t &lhs, const code_t rhs) { return pstring_t(lhs) += rhs; } - friend pstring_t operator+(const code_t lhs, const pstring_t &rhs) { return pstring_t(1, lhs) += rhs; } + friend pstring_t operator+(const pstring_t &lhs, code_t rhs) { return pstring_t(lhs) += rhs; } + friend pstring_t operator+(code_t lhs, const pstring_t &rhs) { return pstring_t(1, lhs) += rhs; } // comparison operators bool operator==(const pstring_t &string) const noexcept { return (compare(string) == 0); } diff --git a/src/lib/netlist/plib/ptokenizer.cpp b/src/lib/netlist/plib/ptokenizer.cpp index a29b3342333..7ccb0ff8ca2 100644 --- a/src/lib/netlist/plib/ptokenizer.cpp +++ b/src/lib/netlist/plib/ptokenizer.cpp @@ -292,7 +292,7 @@ namespace plib { pstring e = plib::pfmt("{1}:{2}:0: error: {3}\n") (m_source_location.back().file_name(), m_source_location.back().line(), errs()); m_source_location.pop_back(); - while (m_source_location.size() > 0) + while (!m_source_location.empty()) { if (m_source_location.size() == 1) trail = trail_first; diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 6fd7c03b446..0f9d1088076 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -218,8 +218,24 @@ public: for (auto & r : roms) setup().register_source(plib::make_unique<netlist_data_folder_t>(r)); +#if 0 using a = plib::psource_str_t<plib::psource_t>; +#if USE_EVAL + const pstring content = + "#define RES_R(res) (res) \n" + "#define RES_K(res) ((res) * 1e3) \n" + "#define RES_M(res) ((res) * 1e6) \n" + "#define CAP_U(cap) ((cap) * 1e-6) \n" + "#define CAP_N(cap) ((cap) * 1e-9) \n" + "#define CAP_P(cap) ((cap) * 1e-12) \n" + "#define IND_U(ind) ((ind) * 1e-6) \n" + "#define IND_N(ind) ((ind) * 1e-9) \n" + "#define IND_P(ind) ((ind) * 1e-12) \n"; + setup().add_include(plib::make_unique<a>("netlist/devices/net_lib.h", content)); +#else setup().add_include(plib::make_unique<a>("netlist/devices/net_lib.h","")); +#endif +#endif for (auto & i : includes) setup().add_include(plib::make_unique<netlist_data_folder_t>(i)); diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp index 951ae526999..f6d9c0c579b 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.cpp +++ b/src/lib/netlist/solver/nld_matrix_solver.cpp @@ -433,7 +433,7 @@ namespace solver d->timestep(dd); } - const netlist_time matrix_solver_t::solve(netlist_time_ext now) + netlist_time matrix_solver_t::solve(netlist_time_ext now) { const netlist_time_ext delta = now - m_last_step(); @@ -561,10 +561,8 @@ namespace solver { m_terms[net_idx].add_terminal(term, ot, true); } - // Should this be allowed ? else { - m_rails_temp[net_idx].add_terminal(term, ot, true); log().fatal(MF_FOUND_TERM_WITH_MISSING_OTHERNET(term->name())); throw nl_exception(MF_FOUND_TERM_WITH_MISSING_OTHERNET(term->name())); } diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h index cc63af716d6..a6b3c6774fd 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.h +++ b/src/lib/netlist/solver/nld_matrix_solver.h @@ -177,7 +177,7 @@ namespace solver // after every call to solve, update inputs must be called. // this can be done as well as a batch to ease parallel processing. - const netlist_time solve(netlist_time_ext now); + netlist_time solve(netlist_time_ext now); void update_inputs(); bool has_dynamic_devices() const noexcept { return !m_dynamic_devices.empty(); } diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h index 806e56764ba..fbb8e4a8250 100644 --- a/src/lib/netlist/solver/nld_ms_direct.h +++ b/src/lib/netlist/solver/nld_ms_direct.h @@ -30,7 +30,7 @@ namespace solver matrix_solver_direct_t(netlist_state_t &anetlist, const pstring &name, const analog_net_t::list_t &nets, - const solver_parameters_t *params, const std::size_t size); + const solver_parameters_t *params, std::size_t size); void reset() override { matrix_solver_t::reset(); } @@ -184,7 +184,7 @@ namespace solver matrix_solver_direct_t<FT, SIZE>::matrix_solver_direct_t(netlist_state_t &anetlist, const pstring &name, const analog_net_t::list_t &nets, const solver_parameters_t *params, - const std::size_t size) + std::size_t size) : matrix_solver_ext_t<FT, SIZE>(anetlist, name, nets, params, size) , m_pitch(m_pitch_ABS ? m_pitch_ABS : (((size + 0) + 7) / 8) * 8) , m_A(size, m_pitch) diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h index f63a24a8ccb..be3fd5fa524 100644 --- a/src/lib/netlist/solver/nld_ms_gcr.h +++ b/src/lib/netlist/solver/nld_ms_gcr.h @@ -146,7 +146,7 @@ namespace solver { const auto &nzbd = this->m_terms[i].m_nzbd; - if (nzbd.size() > 0) + if (!nzbd.empty()) { std::size_t pi = mat.diag[i]; diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index a4eedc38ed7..977b6ae7b20 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -291,7 +291,7 @@ namespace devices // process all terminals connected to this net for (auto &term : n.core_terms()) { - netlist.log().verbose("Term {} {}", term->name(), (int) term->type()); + netlist.log().verbose("Term {} {}", term->name(), static_cast<int>(term->type())); // only process analog terminals if (term->is_type(detail::terminal_type::TERMINAL)) { diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp index 0f59820a642..dfc98598a97 100644 --- a/src/lib/netlist/tools/nl_convert.cpp +++ b/src/lib/netlist/tools/nl_convert.cpp @@ -485,18 +485,18 @@ void nl_convert_spice_t::process_line(const pstring &line) } else { - int sce(4); - int scoeff(5 + n); - if ((tt.size() != 5 + 2 * n) || (tt[scoeff-1] != "0")) + unsigned sce(4); + auto scoeff(static_cast<unsigned>(5 + n)); + if ((tt.size() != 5 + 2 * static_cast<unsigned>(n)) || (tt[scoeff-1] != "0")) { out("// IGNORED {}: {}\n", tt[0].c_str(), line.c_str()); break; } pstring lastnet = tt[1]; - for (int i=0; i<n; i++) + for (std::size_t i=0; i < static_cast<std::size_t>(n); i++) { pstring devname = tt[0] + plib::pfmt("{}")(i); - pstring nextnet = (i<n-1) ? tt[1] + "a" + plib::pfmt("{}")(i) : tt[2]; + pstring nextnet = (i<static_cast<std::size_t>(n)-1) ? tt[1] + "a" + plib::pfmt("{}")(i) : tt[2]; auto net2 = plib::psplit(plib::replace_all(plib::replace_all(tt[sce+i],")",""),"(",""),","); add_device("VCVS", devname); add_term(lastnet, devname, 0); @@ -519,8 +519,8 @@ void nl_convert_spice_t::process_line(const pstring &line) case 'F': { auto n=npoly(tt[3]); - int sce(4); - int scoeff(5 + n); + unsigned sce(4); + unsigned scoeff(5 + static_cast<unsigned>(n)); if (n<0) { sce = 3; @@ -529,13 +529,13 @@ void nl_convert_spice_t::process_line(const pstring &line) } else { - if ((tt.size() != 5 + 2 * n) || (tt[scoeff-1] != "0")) + if ((tt.size() != 5 + 2 * static_cast<unsigned>(n)) || (tt[scoeff-1] != "0")) { out("// IGNORED {}: {}\n", tt[0].c_str(), line.c_str()); break; } } - for (int i=0; i<n; i++) + for (std::size_t i=0; i < static_cast<std::size_t>(n); i++) { pstring devname = tt[0] + plib::pfmt("{}")(i); add_device("CCCS", devname); diff --git a/src/mame/drivers/pong.cpp b/src/mame/drivers/pong.cpp index 7699b460935..7d6980a9c9b 100644 --- a/src/mame/drivers/pong.cpp +++ b/src/mame/drivers/pong.cpp @@ -666,7 +666,7 @@ void rebound_state::rebound(machine_config &config) ROM_START( pong ) /* dummy to satisfy game entry*/ ROM_REGION( 0x10000, "maincpu", 0 ) /* enough for netlist */ - ROM_LOAD( "pong.netlist", 0x000000, 0x00473b, CRC(eadaf087) SHA1(4cb9a79f5cb53502105974be61b99ff16ee930e9) ) + ROM_LOAD( "pong.netlist", 0x000000, 18273, CRC(d249ce49) SHA1(e1d2cfca74b75f0520965639e6947a351650fc3e) ) ROM_END ROM_START( breakout ) diff --git a/src/mame/machine/nl_pongf.cpp b/src/mame/machine/nl_pongf.cpp index 534791142c1..e0da08fab29 100644 --- a/src/mame/machine/nl_pongf.cpp +++ b/src/mame/machine/nl_pongf.cpp @@ -7,10 +7,10 @@ ***************************************************************************/ -#ifndef __PLIB_PREPROCESSOR__ +//#ifndef __PLIB_PREPROCESSOR__ #define NL_PROHIBIT_BASEH_INCLUDE 1 #include "netlist/devices/net_lib.h" -#endif +//#endif #define FAST_CLOCK (1) |