- A Logic Circuit Simulation Library in C++





(Topic Guide) Checklist for implementing functional modules


A functional module is one which does not internally make use of other modules like logic gates etc. (see this page for a detailed discussion on modules). It should be derived from the lcs::Module class. The following is a checklist of items which should not be missed while implementing a custom functional module as a derivative of the lcs::Module class. Detailed examples of building functional modules can be found on the examples page.

  1. Register the module to be notified by the input busses in the constructor. This should be done using the lcs::InputBus::notify function. Registration to be notified should be done with all the input busses. See this for more on using the function lcs::InputBus::notify.

  2. Call the onStateChange function as the last operation of the constructor. This point is relevant only for those modules which override the function lcs::Module::onStateChange. A call to this function as the last operation ensures that the input and output bus lines are in a coherent state after module construction. This function should be called after the above two operations, registering with the input busses and locking the output busses, have been performed.

  3. Un-register the module from being notified by the input busses in the destructor. This should be done using the function lcs::InputBus::stopNotification. Un-registration needs to be done with all the input busses. See this for more on using the function lcs::InputBus::stopNotification.

  4. Override the functions lcs::Module::onStateChange, lcs::Module::onPosEdge, lcs::Module::onNegEdge as relevant. If registered with an input bus to be notified of a lcs::LINE_STATE_CHANGE event, then override the function lcs::Module::onStateChange accordingly. If registered with an input bus to be notified of a lcs::LINE_POS_EDGE event, then override the function lcs::Module::onPosEdge accordingly. If registered with an input bus to be notified of a lcs::LINE_NEG_EDGE event, then override the function lcs::Module::onNegEdge accordingly.


Copyright © 2006, 2007 Siva Chandra