[This topic guide is relevant for users desirous of implementing their own functional modules. Implementers of gate level modules and other users, will under normal circumstances, not require to be concerned about driving and un-driving modules.]
Every functional module will have to be driven by the input busses. For this, it has to register with each of the input busses using the lcs::InputBus::drive
function. Module implementers should pass the this
argument to the lcs::InputBus::drive
function in the constructor of their module class.
A module which registers itself to be driven by an input bus should, without fail, de-register itself when it is getting destructed. Else, the input bus will try to drive a non-existant module leading to an immediate termination of the simulation with a segmentation fault. Module implementers should ensure de-registering by calling the function lcs::InputBus::unDrive
for all the input busses to the module. This function should be called with the this
argument in the destructor of the module class.
A complete example of implementing a custom module can be found here.