- A Logic Circuit Simulation Library in C++





lcs::Clock Class Reference

#include <clock.h>

Inheritance diagram for lcs::Clock:

lcs::InputBus< 1 > List of all members.

Detailed Description

This is a clock class which should be used as a pulse generator for the digital system designed using libLCS. Currently, the implementation is such that it permits the use of only one clock in a system. This feature is incorporated by making the constructor private and providing a static member function which returns a Clock object. The returned Clock object is instantiated by a shallow copy-constructor.

The pulse width of the clock can be altered using the lcs::Clock::setPulseWidth function. The pulse width is measured in system time units. By default, the pulse width is set to 100 system time units.

See lcs::SystemTimer for more information.


Public Member Functions

 Clock (const Clock &clk)
 ~Clock ()
virtual void tick ()
void setPulseWidth (unsigned int width)
void notifyTick (TickListener *tl)
void stopTickNotification (TickListener *tl)
void destroyClock (void)

Static Public Member Functions

static const ClockgetClock (void) throw (NullClockException)


Constructor & Destructor Documentation

lcs::Clock::Clock ( const Clock clk  ) 

Copy constructor.

lcs::Clock::~Clock (  ) 

Destructor.


Member Function Documentation

void lcs::Clock::destroyClock ( void   ) 

WARNING :: Do not ever call this function. It is used by the simulation system (the class lcs::Simulation ) to gracefully free the memory used by the single, full Clock object.

static const Clock& lcs::Clock::getClock ( void   )  throw (NullClockException) [static]

Returns a clock object. The returned object is a shallow copy of the single Clock object which can exist.

void lcs::Clock::notifyTick ( TickListener tl  ) 

This function can used by a lcs::TickListener derivative to get notified of a clock pulse.

void lcs::Clock::setPulseWidth ( unsigned int  width  ) 

Sets the pulse width of the clock in system time units.

Parameters:
width The desired pulse width in system time units.

void lcs::Clock::stopTickNotification ( TickListener tl  ) 

A lcs::TickListener derivative which registered to be notified of a clock pulse should de-register using this function when notification is no longer required. Hence, this function should be called before the object ceases to exist in the simulation system. Else, a segmentation fault is bound to occur.

virtual void lcs::Clock::tick (  )  [virtual]

This function is used by lcs::SystemTimer to notify the clock of the system time. This function will never need to be used by a user of libLCS.


Copyright © 2006, 2007 Siva Chandra