summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/core/analog.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/core/analog.h')
-rw-r--r--src/lib/netlist/core/analog.h99
1 files changed, 51 insertions, 48 deletions
diff --git a/src/lib/netlist/core/analog.h b/src/lib/netlist/core/analog.h
index a003e1c37a5..da9639a3de1 100644
--- a/src/lib/netlist/core/analog.h
+++ b/src/lib/netlist/core/analog.h
@@ -20,23 +20,22 @@
namespace netlist
{
- // -----------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// analog_t
- // -----------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
class analog_t : public detail::core_terminal_t
{
public:
-
analog_t(core_device_t &dev, const pstring &aname, state_e state,
nl_delegate delegate);
- const analog_net_t & net() const noexcept
+ const analog_net_t &net() const noexcept
{
return plib::downcast<const analog_net_t &>(core_terminal_t::net());
}
- analog_net_t & net() noexcept
+ analog_net_t &net() noexcept
{
return plib::downcast<analog_net_t &>(core_terminal_t::net());
}
@@ -53,24 +52,23 @@ namespace netlist
class terminal_t : public analog_t
{
public:
-
/// \brief constructor
///
/// \param dev object owning the terminal
/// \param aname name of this terminal
/// \param other_terminal pointer to the sibling terminal
- terminal_t(core_device_t &dev, const pstring &aname, terminal_t *other_terminal, nl_delegate delegate);
+ terminal_t(core_device_t &dev, const pstring &aname,
+ terminal_t *other_terminal, nl_delegate delegate);
- terminal_t(core_device_t &dev, const pstring &aname, terminal_t *other_terminal,
- const std::array<terminal_t *, 2> &splitter_terms, nl_delegate delegate);
+ terminal_t(core_device_t &dev, const pstring &aname,
+ terminal_t * other_terminal,
+ const std::array<terminal_t *, 2> &splitter_terms,
+ nl_delegate delegate);
/// \brief Returns voltage of connected net
///
/// \return voltage of net this terminal is connected to
- nl_fptype operator ()() const noexcept
- {
- return net().Q_Analog();
- }
+ nl_fptype operator()() const noexcept { return net().Q_Analog(); }
/// \brief sets conductivity value of this terminal
///
@@ -85,42 +83,33 @@ namespace netlist
set_go_gt_I(GO, GT, nlconst::zero());
}
- void set_go_gt_I(nl_fptype GO, nl_fptype GT, nl_fptype I) const noexcept
- {
- // Check for rail nets ...
- if (m_go != nullptr)
- {
- *m_Idr = I;
- *m_go = GO;
- *m_gt = GT;
- }
- }
+ void set_go_gt_I(nl_fptype GO, nl_fptype GT,
+ nl_fptype I) const noexcept;
- void set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept(false);
+ void set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept(
+ false);
private:
nl_fptype *m_Idr; ///< drive current
nl_fptype *m_go; ///< conductance for Voltage from other term
nl_fptype *m_gt; ///< conductance for total conductance
-
};
- // -----------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// analog_input_t
- // -----------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
/// \brief terminal providing analog input voltage.
///
- /// This terminal class provides a voltage measurement. The conductance against
- /// ground is infinite.
-
+ /// This terminal class provides a voltage measurement. The conductance
+ /// against ground is infinite.
class analog_input_t : public analog_t
{
public:
/// \brief Constructor
- analog_input_t(core_device_t &dev, ///< owning device
- const pstring &aname, ///< name of terminal
- nl_delegate delegate ///< delegate
+ analog_input_t(core_device_t &dev, ///< owning device
+ const pstring & aname, ///< name of terminal
+ nl_delegate delegate ///< delegate
);
/// \brief returns voltage at terminal.
@@ -129,29 +118,19 @@ namespace netlist
/// \brief returns voltage at terminal.
/// \returns voltage at terminal.
- nl_fptype Q_Analog() const noexcept
- {
- return net().Q_Analog();
- }
+ nl_fptype Q_Analog() const noexcept { return net().Q_Analog(); }
};
- // -----------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// analog_output_t
- // -----------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
class analog_output_t : public analog_t
{
public:
analog_output_t(core_device_t &dev, const pstring &aname);
- void push(nl_fptype val) noexcept
- {
- if (val != m_my_net.Q_Analog())
- {
- m_my_net.set_Q_Analog(val);
- m_my_net.toggle_and_push_to_queue(netlist_time::quantum());
- }
- }
+ void push(nl_fptype val) noexcept;
void initial(nl_fptype val) noexcept;
@@ -159,12 +138,36 @@ namespace netlist
analog_net_t m_my_net;
};
+ // -------------------------------------------------------------------------
+ // out of class
+ // -------------------------------------------------------------------------
+
inline solver::matrix_solver_t *analog_t::solver() const noexcept
{
return (this->has_net() ? net().solver() : nullptr);
}
-} // namespace netlist
+ inline void terminal_t::set_go_gt_I(nl_fptype GO, nl_fptype GT,
+ nl_fptype I) const noexcept
+ {
+ // Check for rail nets ...
+ if (m_go != nullptr)
+ {
+ *m_Idr = I;
+ *m_go = GO;
+ *m_gt = GT;
+ }
+ }
+ inline void analog_output_t::push(nl_fptype val) noexcept
+ {
+ if (val != m_my_net.Q_Analog())
+ {
+ m_my_net.set_Q_Analog(val);
+ m_my_net.toggle_and_push_to_queue(netlist_time::quantum());
+ }
+ }
+
+} // namespace netlist
#endif // NL_CORE_ANALOG_H_