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.
lcs::InputBus::drive
function. Registration to be driven should be done with all the input busses.
lcs::Bus::lock
function. See this topic guide for more information on locking busses. All output busses should be locked by a functional module.
propogate
function as the last operation of the constructor. This 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, are performed.
lcs::InputBus::unDrive
function. Un-registration needs to be done with all the input busses.
lcs::Bus::unLock
function. See this topic guide for more information. All the output busses have to be unlocked by the module.
lcs::Module::propogate
function. If registered with an input bus, the module is triggered by by through the lcs::Module::propogate
function whenever the line state of the input bus changes. When triggered, the lcs::Module::propogate
function should read the input bus states and calculate the outbus bus lines states. The output bus line states should then be set using the suitable lcs::Bus::LineAccessor
object. See this topic guide for more information on setting the output bus lines.