mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
netlist: clang lint fixes, srcclean and nlwav fix. (nw)
This commit is contained in:
parent
334e367d4d
commit
9431ee68e7
@ -14,7 +14,7 @@ VSBUILD = $(SRC)/buildVS
|
||||
DOC = $(SRC)/documentation
|
||||
TIDY_DB = ../compile_commands.json
|
||||
|
||||
TIDY_FLAGSX = -checks=*,-google*,-hicpp*,-readability*,-fuchsia*,cert-*,-android-*,
|
||||
TIDY_FLAGSX = -checks=*,-google*,-hicpp*,readability*,-fuchsia*,cert-*,-android-*,
|
||||
TIDY_FLAGSX += -llvm-header-guard,-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-owning-memory,
|
||||
TIDY_FLAGSX += -modernize-use-default-member-init,-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
@ -25,7 +25,8 @@ TIDY_FLAGSX += -cppcoreguidelines-non-private-member-variables-in-classes,-misc-
|
||||
TIDY_FLAGSX += -bugprone-macro-parentheses,-misc-macro-parentheses,
|
||||
TIDY_FLAGSX += -bugprone-too-small-loop-variable,
|
||||
TIDY_FLAGSX += -modernize-use-trailing-return-type,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-array-to-pointer-decay
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
TIDY_FLAGSX += -readability-magic-numbers,-readability-implicit-bool-conversion,readability-braces-around-statements
|
||||
|
||||
space :=
|
||||
space +=
|
||||
@ -106,6 +107,7 @@ NLOBJS := \
|
||||
$(NLOBJ)/devices/nld_2102A.o \
|
||||
$(NLOBJ)/devices/nld_2716.o \
|
||||
$(NLOBJ)/devices/nld_tms4800.o \
|
||||
$(NLOBJ)/devices/nld_4006.o \
|
||||
$(NLOBJ)/devices/nld_4020.o \
|
||||
$(NLOBJ)/devices/nld_4066.o \
|
||||
$(NLOBJ)/devices/nld_4316.o \
|
||||
|
@ -54,10 +54,10 @@ namespace netlist
|
||||
}
|
||||
else
|
||||
{
|
||||
m_d[0] = (m_d[0] & 0x0f) | (m_I[0]() << 4);
|
||||
m_d[1] = (m_d[1] & 0x1f) | (m_I[1]() << 5);
|
||||
m_d[2] = (m_d[2] & 0x0f) | (m_I[2]() << 4);
|
||||
m_d[3] = (m_d[3] & 0x1f) | (m_I[3]() << 5);
|
||||
m_d[0] = static_cast<uint8_t>((m_d[0] & 0x0f) | (m_I[0]() << 4));
|
||||
m_d[1] = static_cast<uint8_t>((m_d[1] & 0x1f) | (m_I[1]() << 5));
|
||||
m_d[2] = static_cast<uint8_t>((m_d[2] & 0x0f) | (m_I[2]() << 4));
|
||||
m_d[3] = static_cast<uint8_t>((m_d[3] & 0x1f) | (m_I[3]() << 5));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ class NETLIB_NAME(name) : public device_t
|
||||
/// Please see \ref NETLIB_IS_TIMESTEP for an example.
|
||||
|
||||
#define NETLIB_TIMESTEPI() \
|
||||
public: virtual void timestep(const nl_fptype step) noexcept override
|
||||
public: virtual void timestep(nl_fptype step) noexcept override
|
||||
|
||||
/// \brief Used to implement the body of the time stepping code.
|
||||
///
|
||||
@ -590,7 +590,7 @@ namespace netlist
|
||||
};
|
||||
|
||||
core_terminal_t(core_device_t &dev, const pstring &aname,
|
||||
const state_e state, nldelegate delegate = nldelegate());
|
||||
state_e state, nldelegate delegate = nldelegate());
|
||||
virtual ~core_terminal_t() noexcept = default;
|
||||
|
||||
COPYASSIGNMOVE(core_terminal_t, delete)
|
||||
@ -632,7 +632,7 @@ namespace netlist
|
||||
|
||||
state_var_sig m_Q;
|
||||
#else
|
||||
void set_copied_input(netlist_sig_t val) const noexcept { plib::unused_var(val); }
|
||||
static void set_copied_input(netlist_sig_t val) noexcept { plib::unused_var(val); }
|
||||
#endif
|
||||
|
||||
void set_delegate(const nldelegate &delegate) noexcept { m_delegate = delegate; }
|
||||
@ -788,7 +788,7 @@ namespace netlist
|
||||
{
|
||||
public:
|
||||
|
||||
analog_t(core_device_t &dev, const pstring &aname, const state_e state,
|
||||
analog_t(core_device_t &dev, const pstring &aname, state_e state,
|
||||
nldelegate delegate = nldelegate());
|
||||
|
||||
const analog_net_t & net() const noexcept;
|
||||
@ -849,7 +849,7 @@ namespace netlist
|
||||
{
|
||||
public:
|
||||
logic_t(core_device_t &dev, const pstring &aname,
|
||||
const state_e state, nldelegate delegate = nldelegate());
|
||||
state_e state, nldelegate delegate = nldelegate());
|
||||
|
||||
logic_net_t & net() noexcept;
|
||||
const logic_net_t & net() const noexcept;
|
||||
@ -1148,7 +1148,7 @@ namespace netlist
|
||||
class param_num_t final: public param_t
|
||||
{
|
||||
public:
|
||||
param_num_t(device_t &device, const pstring &name, const T val) noexcept(false);
|
||||
param_num_t(device_t &device, const pstring &name, T val) noexcept(false);
|
||||
|
||||
T operator()() const noexcept { return m_param; }
|
||||
operator T() const noexcept { return m_param; }
|
||||
@ -1162,7 +1162,7 @@ namespace netlist
|
||||
class param_enum_t final: public param_t
|
||||
{
|
||||
public:
|
||||
param_enum_t(device_t &device, const pstring &name, const T val) noexcept(false);
|
||||
param_enum_t(device_t &device, const pstring &name, T val) noexcept(false);
|
||||
|
||||
T operator()() const noexcept { return T(m_param); }
|
||||
operator T() const noexcept { return T(m_param); }
|
||||
@ -1932,12 +1932,10 @@ namespace netlist
|
||||
state().log().fatal("Inconsistent nullptrs for terminal {}", name());
|
||||
throw nl_exception("Inconsistent nullptrs for terminal {}", name());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gt1 = gt;
|
||||
m_go1 = go;
|
||||
m_Idr1 = Idr;
|
||||
}
|
||||
|
||||
m_gt1 = gt;
|
||||
m_go1 = go;
|
||||
m_Idr1 = Idr;
|
||||
}
|
||||
|
||||
inline logic_net_t & logic_t::net() noexcept
|
||||
|
@ -13,9 +13,9 @@
|
||||
namespace netlist
|
||||
{
|
||||
|
||||
static constexpr const char sHINT_NO_DEACTIVATE[] = ".HINT_NO_DEACTIVATE";
|
||||
static constexpr const char sPowerGND[] = "GND";
|
||||
static constexpr const char sPowerVCC[] = "VCC";
|
||||
static constexpr const char sHINT_NO_DEACTIVATE[] = ".HINT_NO_DEACTIVATE"; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
|
||||
static constexpr const char sPowerGND[] = "GND"; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
|
||||
static constexpr const char sPowerVCC[] = "VCC"; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
|
||||
|
||||
// nl_base.cpp
|
||||
|
||||
|
@ -107,13 +107,13 @@ namespace plib {
|
||||
|
||||
parray(const parray &rhs) : m_a(rhs.m_a), m_size(rhs.m_size) {}
|
||||
parray(parray &&rhs) noexcept : m_a(std::move(rhs.m_a)), m_size(std::move(rhs.m_size)) {}
|
||||
parray &operator=(const parray &rhs) noexcept
|
||||
parray &operator=(const parray &rhs) noexcept // NOLINT(bugprone-unhandled-self-assignment, cert-oop54-cpp)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
m_a = rhs.m_a;
|
||||
m_size = rhs.m_size;
|
||||
}
|
||||
if (this == &rhs)
|
||||
return *this;
|
||||
|
||||
m_a = rhs.m_a;
|
||||
m_size = rhs.m_size;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ namespace plib {
|
||||
struct perrmsg
|
||||
{
|
||||
template<std::size_t N, typename... Args>
|
||||
explicit perrmsg(const char (&fmt)[N], Args&&... args)
|
||||
explicit perrmsg(const char (&fmt)[N], Args&&... args) // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
|
||||
: m_msg(plib::pfmt(fmt)(std::forward<Args>(args)...))
|
||||
{ }
|
||||
operator pstring const & () const noexcept { return m_msg; }
|
||||
|
@ -133,10 +133,12 @@ namespace plib {
|
||||
constexpr iter_t(iter_t &rhs) noexcept : p(rhs.p) { }
|
||||
iter_t(iter_t &&rhs) noexcept { std::swap(*this, rhs); }
|
||||
|
||||
iter_t& operator=(const iter_t &rhs) noexcept
|
||||
iter_t& operator=(const iter_t &rhs) noexcept // NOLINT(bugprone-unhandled-self-assignment, cert-oop54-cpp)
|
||||
{
|
||||
if (this != &rhs)
|
||||
p = rhs.p;
|
||||
if (this == &rhs)
|
||||
return *this;
|
||||
|
||||
p = rhs.p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public:
|
||||
|
||||
size_type length() const noexcept { return traits_type::len(m_str); }
|
||||
size_type size() const noexcept { return traits_type::len(m_str); }
|
||||
bool empty() const noexcept { return m_str.size() == 0; }
|
||||
bool empty() const noexcept { return m_str.empty(); }
|
||||
|
||||
pstring_t substr(size_type start, size_type nlen = npos) const;
|
||||
int compare(const pstring_t &right) const noexcept;
|
||||
@ -317,7 +317,9 @@ struct putf8_traits
|
||||
const mem_t *p1 = p;
|
||||
std::size_t i = n;
|
||||
while (i-- > 0)
|
||||
{
|
||||
p1 += codelen(p1);
|
||||
}
|
||||
return p1;
|
||||
}
|
||||
};
|
||||
@ -336,7 +338,9 @@ struct putf16_traits
|
||||
// FIXME: check that size is equal
|
||||
auto c = static_cast<uint16_t>(*i++);
|
||||
if (!((c & 0xd800) == 0xd800))
|
||||
{
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -347,10 +351,7 @@ struct putf16_traits
|
||||
}
|
||||
static std::size_t codelen(const code_t c) noexcept
|
||||
{
|
||||
if (c < 0x10000)
|
||||
return 1;
|
||||
else // U+10000 U+1FFFFF
|
||||
return 2;
|
||||
return (c < 0x10000) ? 1 : 2; // U+10000 U+1FFFFF
|
||||
}
|
||||
static code_t code(const mem_t *p) noexcept
|
||||
{
|
||||
@ -381,7 +382,9 @@ struct putf16_traits
|
||||
{
|
||||
std::size_t i = n;
|
||||
while (i-- > 0)
|
||||
{
|
||||
p += codelen(p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
@ -156,10 +156,8 @@ namespace plib
|
||||
|
||||
typename TS::stream_ptr stream(const pstring &name) override
|
||||
{
|
||||
if (name == m_name)
|
||||
return plib::make_unique<std::stringstream>(m_str);
|
||||
else
|
||||
return typename TS::stream_ptr(nullptr);
|
||||
return (name == m_name) ?
|
||||
plib::make_unique<std::stringstream>(m_str) : typename TS::stream_ptr(nullptr);
|
||||
}
|
||||
private:
|
||||
pstring m_name;
|
||||
@ -279,7 +277,7 @@ namespace plib
|
||||
std::vector<pstring> psplit(const pstring &str, const std::vector<pstring> &onstrl);
|
||||
std::vector<std::string> psplit_r(const std::string &stri,
|
||||
const std::string &token,
|
||||
const std::size_t maxsplit);
|
||||
std::size_t maxsplit);
|
||||
|
||||
//============================================================
|
||||
// penum - strongly typed enumeration
|
||||
|
@ -494,8 +494,6 @@ void nlwav_app::convert(std::ostream &ostrm)
|
||||
|
||||
int nlwav_app::execute()
|
||||
{
|
||||
for (auto &i : opt_args())
|
||||
pout("Hello : " + i + "\n");
|
||||
if (opt_help())
|
||||
{
|
||||
pout(usage());
|
||||
|
@ -15,6 +15,8 @@
|
||||
// define a model param on core device
|
||||
|
||||
// Format: external name,netlist device,model
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||
static constexpr const char s_lib_map[] =
|
||||
"SN74LS00D, TTL_7400_DIP, 74LSXX\n"
|
||||
"SN74LS04D, TTL_7404_DIP, 74LSXX\n"
|
||||
|
@ -9,17 +9,17 @@
|
||||
NETLIST_START(segas16b_audio)
|
||||
SOLVER(Solver, 48000)
|
||||
//PARAM(Solver.DYNAMIC_TS, 1)
|
||||
|
||||
|
||||
ANALOG_INPUT(VP5, 5)
|
||||
ANALOG_INPUT(VP12, 12)
|
||||
|
||||
/* UPD7759 has resistor of 47K on reference pin
|
||||
/* UPD7759 has resistor of 47K on reference pin
|
||||
* ==> IREF ~30 uA
|
||||
* According to datasheet maximum current sink
|
||||
* is 34 * IREF.
|
||||
*
|
||||
*
|
||||
* MAME must provide range of 0 to 1020 uA to the current sink.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
CLOCK(T0, 10)
|
||||
@ -34,7 +34,7 @@ NETLIST_START(segas16b_audio)
|
||||
NET_C(GND, T2.2, T1.2)
|
||||
NET_C(T1.1, T2.1, T0R.2)
|
||||
#endif
|
||||
|
||||
|
||||
CS(SPEECH, 0)
|
||||
//PARAM(SPEECH.FUNC, "0.001020 * (0.5 + 0.5 * sin(6280 * T))")
|
||||
NET_C(SPEECH.2, GND)
|
||||
@ -48,57 +48,57 @@ NETLIST_START(segas16b_audio)
|
||||
NET_C(CH1VS.2, GND)
|
||||
ALIAS(CH2, CH1VS.1)
|
||||
#endif
|
||||
|
||||
|
||||
/* The YM3012 uses only one dac for the two channels.
|
||||
* Sample-and-hold is used to two toggle between the two channels.
|
||||
* This is not emulated here since the YM2151 signals are provided
|
||||
* externally.
|
||||
*
|
||||
* externally.
|
||||
*
|
||||
* Therefore two RCOM resistors are used for now directly connected
|
||||
* to the channels.
|
||||
*
|
||||
*
|
||||
* The YM3012 datasheet gives a formula for digital to VOUT:
|
||||
* VOUT = 0.5 VDD + 0.25 * VDD *(-1 + D9 + d8/2 .. + d0/512 + 1/1024)/pow(2,N)
|
||||
* N= S2Q*4+S1Q*2+S0Q
|
||||
* 3 bits ignored (I0,I1,I2)
|
||||
* Serial data stream: I0,I1,I2,D0,..., D9,S0,S1,S2
|
||||
*
|
||||
* Basically output is between 0.25 * VDD and 0.75 * VDD.
|
||||
*
|
||||
* Basically output is between 0.25 * VDD and 0.75 * VDD.
|
||||
* This needs to be done in MAME interface
|
||||
*/
|
||||
|
||||
|
||||
TL084_DIP(D20)
|
||||
LM324_DIP(XC20)
|
||||
|
||||
RES(RCOM1, 390)
|
||||
RES(RCOM2, 390)
|
||||
|
||||
|
||||
CAP(C21, CAP_U(2.2))
|
||||
CAP(C22, CAP_U(2.2)) // Needs verification
|
||||
CAP(C27, CAP_P(1500))
|
||||
CAP(C28, CAP_P(1500))
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// YM2151/YM3012 inputs
|
||||
// ------------------------------------
|
||||
|
||||
|
||||
NET_C(CH1, RCOM1.1)
|
||||
NET_C(RCOM1.2, C27.1, D20.5)
|
||||
NET_C(D20.7, D20.6, C22.1)
|
||||
|
||||
|
||||
NET_C(CH2, RCOM2.1)
|
||||
NET_C(RCOM2.2, C28.1, D20.10)
|
||||
NET_C(D20.8, D20.9, C21.1)
|
||||
|
||||
|
||||
NET_C(GND, C27.2, C28.2)
|
||||
|
||||
|
||||
// OPAMPS, no information on schematics, assume 12V since
|
||||
// TL084 with 5V would be outside specifications
|
||||
// No negative voltages found on schematics
|
||||
|
||||
|
||||
NET_C(VP12, XC20.4, D20.4)
|
||||
NET_C(GND, XC20.11, D20.11)
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// Speech inputs
|
||||
// ------------------------------------
|
||||
@ -120,11 +120,11 @@ NETLIST_START(segas16b_audio)
|
||||
NET_C(R14.2, R16.1, C26.1, R15.1)
|
||||
NET_C(R15.2, C25.1, XC20.5)
|
||||
NET_C(XC20.7, XC20.6, C26.2, R12.1)
|
||||
|
||||
|
||||
NET_C(R12.2, C23.1, R13.1)
|
||||
NET_C(R13.2, C29.1, XC20.3)
|
||||
NET_C(XC20.1, XC20.2, C23.2, C62.1)
|
||||
|
||||
|
||||
NET_C(GND, R16.2, C25.2, C29.2)
|
||||
|
||||
// ------------------------------------
|
||||
@ -144,22 +144,22 @@ NETLIST_START(segas16b_audio)
|
||||
CAP(C20, CAP_P(1000))
|
||||
CAP(C19, CAP_U(47)) // FIXME: Needs verification
|
||||
RES(AMP_IN, RES_K(100))
|
||||
|
||||
|
||||
NET_C(C62.2, R6.1)
|
||||
NET_C(C22.2, R9.1)
|
||||
NET_C(C21.2, R10.1)
|
||||
NET_C(R6.2, R9.2, R10.2, XC20.9, C20.1, R7.1) // FIXME: Schematics read "9" (XC20.9) - other AMP?
|
||||
NET_C(R7.2, C20.2, C63.1, XC20.8) // FIXME: Schematics read "7" (XC20.7) - other AMP?
|
||||
|
||||
|
||||
NET_C(VP5, R4.1)
|
||||
NET_C(R4.2, C19.1, R5.1, XC20.10) // FIXME: Schematics read "8" (XC20.8) - other AMP?
|
||||
|
||||
|
||||
NET_C(C63.2, R3.1)
|
||||
NET_C(R3.2, VR1.1, C12.1)
|
||||
NET_C(C12.2, AMP_IN.1)
|
||||
|
||||
|
||||
NET_C(GND, VR1.2, C19.2, R5.2, AMP_IN.2)
|
||||
|
||||
|
||||
// OUTPUT
|
||||
|
||||
ALIAS(OUT, AMP_IN.1)
|
||||
|
Loading…
Reference in New Issue
Block a user