diff options
Diffstat (limited to 'src/lib/netlist/core/logic.h')
-rw-r--r-- | src/lib/netlist/core/logic.h | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/src/lib/netlist/core/logic.h b/src/lib/netlist/core/logic.h index 2efa92d8f6d..ef567398c84 100644 --- a/src/lib/netlist/core/logic.h +++ b/src/lib/netlist/core/logic.h @@ -2,7 +2,7 @@ // copyright-holders:Couriersud /// -/// \file param.h +/// \file logic.h /// #ifndef NL_CORE_LOGIC_H_ @@ -22,37 +22,39 @@ namespace netlist { - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // logic_t - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- - class logic_t : public detail::core_terminal_t, public logic_family_t + class logic_t + : public detail::core_terminal_t + , public logic_family_t { public: - logic_t(device_t &dev, const pstring &aname, - state_e terminal_state, nl_delegate delegate); + logic_t(device_t &dev, const pstring &aname, state_e terminal_state, + nl_delegate delegate); - logic_net_t & net() noexcept + logic_net_t &net() noexcept { return plib::downcast<logic_net_t &>(core_terminal_t::net()); } - constexpr const logic_net_t & net() const noexcept + constexpr const logic_net_t &net() const noexcept { return plib::downcast<const logic_net_t &>(core_terminal_t::net()); } }; - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // logic_input_t - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- class logic_input_t : public logic_t { public: logic_input_t(device_t &dev, const pstring &aname, - nl_delegate delegate); + nl_delegate delegate); - //const netlist_sig_t &operator()() const noexcept + // const netlist_sig_t &operator()() const noexcept constexpr netlist_sig_t operator()() const noexcept { gsl_Expects(terminal_state() != STATE_INP_PASSIVE); @@ -97,17 +99,15 @@ namespace netlist set_state(STATE_INP_LH); } } - }; - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // logic_output_t - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- class logic_output_t : public logic_t { public: - /// \brief logic output constructor /// /// The third parameter does nothing. It is provided only for @@ -115,7 +115,8 @@ namespace netlist /// /// \param dev Device owning this output /// \param aname The name of this output - /// \param dummy Dummy parameter to allow construction like tristate output + /// \param dummy Dummy parameter to allow construction like tristate + /// output /// logic_output_t(device_t &dev, const pstring &aname, bool dummy = false); @@ -142,17 +143,20 @@ namespace netlist /// This function terminates if actually called. /// [[noreturn]] static void set_tristate([[maybe_unused]] netlist_sig_t v, - [[maybe_unused]] netlist_time ts_off_on, [[maybe_unused]] netlist_time ts_on_off) + [[maybe_unused]] netlist_time ts_off_on, + [[maybe_unused]] netlist_time ts_on_off) { - plib::terminate("set_tristate on logic_output should never be called!"); + plib::terminate( + "set_tristate on logic_output should never be called!"); } + private: logic_net_t m_my_net; }; - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // tristate_output_t - // ----------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /// \brief Tristate output /// @@ -170,8 +174,8 @@ namespace netlist class tristate_output_t : public logic_output_t { public: - - tristate_output_t(device_t &dev, const pstring &aname, bool force_logic); + tristate_output_t(device_t &dev, const pstring &aname, + bool force_logic); void push(netlist_sig_t newQ, netlist_time delay) noexcept { @@ -180,31 +184,29 @@ namespace netlist m_last_logic = newQ; } - void set_tristate(netlist_sig_t v, - netlist_time ts_off_on, netlist_time ts_on_off) noexcept + void set_tristate(netlist_sig_t v, netlist_time ts_off_on, + netlist_time ts_on_off) noexcept { if (!m_force_logic) if (v != m_tristate) { - logic_output_t::push((v != 0) ? OUT_TRISTATE() : m_last_logic, v ? ts_off_on : ts_on_off); + logic_output_t::push((v != 0) ? OUT_TRISTATE() + : m_last_logic, + v ? ts_off_on : ts_on_off); m_tristate = v; } } - bool is_force_logic() const noexcept - { - return m_force_logic; - } + bool is_force_logic() const noexcept { return m_force_logic; } private: using logic_output_t::initial; using logic_output_t::set_Q_time; state_var<netlist_sig_t> m_last_logic; state_var<netlist_sig_t> m_tristate; - bool m_force_logic; + bool m_force_logic; }; } // namespace netlist - #endif // NL_CORE_LOGIC_H_ |