LogicOut Class Reference

Logic output/input. More...

#include <logic.h>

Inheritance diagram for LogicOut:

Inheritance graph
[legend]
Collaboration diagram for LogicOut:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LogicOut (LogicConfig config, bool _high)
virtual ~LogicOut ()
virtual void setLogic (LogicConfig config)
virtual void setElementSet (ElementSet *c)
virtual void add_map ()
virtual Type type () const
void setOutputHighConductance (double g)
void setOutputLowConductance (double g)
void setOutputHighVoltage (double v)
double outputHighVoltage () const
void setHigh (bool high)
bool outputState () const
void setUseLogicChain (bool use)
void setNextChanged (LogicOut *logicOut, unsigned char chain)
void setCanAddChanged (bool canAdd)
LogicOutnextChanged (unsigned char chain) const

Public Attributes

PinList pinList
PinList::iterator pinListBegin
PinList::iterator pinListEnd

Protected Member Functions

void configChanged ()
virtual void updateCurrents ()
virtual void add_initial_dc ()

Protected Attributes

double m_gHigh
double m_gLow
double m_vHigh
bool m_bOutputHighConductanceConst
bool m_bOutputLowConductanceConst
bool m_bOutputHighVoltageConst
double m_g_out
double m_v_out
double m_old_g_out
double m_old_v_out
bool b_state
bool m_bCanAddChanged
LogicOutm_pNextChanged [2]
Simulatorm_pSimulator
bool m_bUseLogicChain

Detailed Description

Logic output/input.

Definition at line 115 of file logic.h.


Member Function Documentation

void LogicOut::setLogic ( LogicConfig  config  )  [virtual]

Set logic values from the LogicConfig.

Reimplemented from LogicIn.

Definition at line 184 of file logic.cpp.

References configChanged(), LogicConfig::highImpedance, LogicConfig::lowImpedance, m_bOutputHighConductanceConst, m_bOutputHighVoltageConst, m_bOutputLowConductanceConst, LogicIn::m_config, m_gHigh, m_gLow, m_vHigh, and LogicConfig::output.

Referenced by LogicOut().

void LogicOut::setElementSet ( ElementSet c  )  [virtual]

This must be called when the circuit is changed. The function will get all the required pointers from ElementSet

Reimplemented from LogicIn.

Definition at line 144 of file logic.cpp.

References b_state, m_bUseLogicChain, m_g_out, m_gHigh, m_gLow, m_pNextChanged, m_pSimulator, m_v_out, m_vHigh, Simulator::self(), and LogicIn::setElementSet().

Referenced by setUseLogicChain().

void LogicOut::add_map (  )  [virtual]

Call this function to tell the element to add its map to the matrix in use

Reimplemented from Element.

Definition at line 224 of file logic.cpp.

References Element::b_status, Element::p_A, Element::p_cnode, and Matrix::setUse().

virtual Type LogicOut::type (  )  const [inline, virtual]

Returns the type of element

Reimplemented from LogicIn.

Definition at line 124 of file logic.h.

void LogicOut::setOutputHighConductance ( double  g  ) 

Call this function to override the logic-high output impedance as set by the user. Once set, the impedance will not be changed by the user updating the config; only by subsequent calls to this function.

Definition at line 160 of file logic.cpp.

References configChanged(), m_bOutputHighConductanceConst, and m_gHigh.

Referenced by PICComponentPin::PICComponentPin(), and PICComponentPin::set_nodeVoltage().

void LogicOut::setOutputLowConductance ( double  g  ) 

Call this function to override the logic-low output impedance as set by the user. Once set, the impedance will not be changed by the user updating the config; only by subsequent calls to this function.

Definition at line 168 of file logic.cpp.

References configChanged(), m_bOutputLowConductanceConst, and m_gLow.

Referenced by PICComponentPin::set_nodeVoltage().

void LogicOut::setOutputHighVoltage ( double  v  ) 

Call this function to override the logic out voltage as set by the user. Once set, the impedance will not be changed by the user updating the config; only by subsequent calls to this function.

Definition at line 176 of file logic.cpp.

References configChanged(), m_bOutputHighVoltageConst, and m_vHigh.

Referenced by PICComponentPin::PICComponentPin().

double LogicOut::outputHighVoltage (  )  const [inline]

Returns the voltage that this will output when high.

Definition at line 147 of file logic.h.

References m_vHigh.

void LogicOut::setHigh ( bool  high  ) 

Sets the pin to be high/low

Definition at line 252 of file logic.cpp.

References add_initial_dc(), Simulator::addChangedCircuit(), Simulator::addChangedLogic(), b_state, Circuit::canAddChanged(), ElementSet::circuit(), m_bCanAddChanged, m_bUseLogicChain, m_g_out, m_gHigh, m_gLow, m_old_g_out, m_old_v_out, m_pSimulator, m_v_out, m_vHigh, Element::p_eSet, and Circuit::setCanAddChanged().

Referenced by ECLogicInput::buttonStateChanged(), ECSRFlipFlop::ECSRFlipFlop(), Multiplexer::inStateChanged(), ECOr::inStateChanged(), ECXor::inStateChanged(), FullAdder::inStateChanged(), ECSRFlipFlop::inStateChanged(), LogicOut(), PICComponentPin::resetOutput(), PICComponentPin::set_nodeVoltage(), ECClockInput::stepCallback(), ECClockInput::stepLogic(), and SerialPortComponent::stepNonLogic().

bool LogicOut::outputState (  )  const [inline]

Returns:
the state that this is outputting (regardless of voltage level on logic)

Definition at line 155 of file logic.h.

References b_state.

Referenced by Simulator::createLogicChain().

void LogicOut::setUseLogicChain ( bool  use  ) 

Set whether or not this LogicOut is the head of a LogicChain (controls itself and a bunch of LogicIns).

Definition at line 135 of file logic.cpp.

References m_bUseLogicChain, m_pSimulator, Simulator::self(), and setElementSet().

Referenced by Simulator::createLogicChain().

void LogicOut::setNextChanged ( LogicOut logicOut,
unsigned char  chain 
) [inline]

When a LogicOut configured as the start of a LogicChain changes start, it appends a pointer to itself to the list of change LogicOut, starting from the Simulator. This functions enables appending the next changed LogicOut to this one.

Definition at line 167 of file logic.h.

References m_pNextChanged.

Referenced by Simulator::addChangedLogic(), and Simulator::removeLogicOutReferences().

void LogicOut::setCanAddChanged ( bool  canAdd  )  [inline]

To avoid a pointer to this LogicOut being added twice in one iteration due to the state changing twice, this LogicOut sets an added flag to true after adding it to the list of changed. The flag must be reset to false with this function (done by Simulator).

Definition at line 174 of file logic.h.

References m_bCanAddChanged.

Referenced by Simulator::createLogicChain().

LogicOut* LogicOut::nextChanged ( unsigned char  chain  )  const [inline]

Returns the next LogicOut that has changed, when configured as the start of a LogicChain.

See also:
setNextChanged

Definition at line 180 of file logic.h.

References m_pNextChanged.

Referenced by Simulator::createLogicChain(), and Simulator::removeLogicOutReferences().

void LogicOut::updateCurrents (  )  [protected, virtual]

Call this function to tell the element to calculate the current flowing *into* it's cnodes *from* the element. You can get the currents with m_cnodeI. Child class must implement this function.

Reimplemented from LogicIn.

Definition at line 240 of file logic.cpp.

References Element::b_status, m_bUseLogicChain, Element::m_cnodeI, m_g_out, m_v_out, Element::p_cnode, and CNode::v.

void LogicOut::add_initial_dc (  )  [protected, virtual]

Does the required MNA stuff. This should be called from ElementSet when necessary.

Reimplemented from LogicIn.

Definition at line 232 of file logic.cpp.

References Element::A_g(), Element::b_i(), Element::b_status, m_g_out, m_old_g_out, m_old_v_out, and m_v_out.

Referenced by configChanged(), and setHigh().


The documentation for this class was generated from the following files:
Generated on Tue May 8 17:05:47 2007 for KTechLab by  doxygen 1.5.1