- 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 notifyTick (TickListener *tl)
void stopTickNotification (TickListener *tl)

Static Public Member Functions

static Clock getClock (void) throw (NullClockException)
static void setPulseWidth (unsigned int width)


Constructor & Destructor Documentation

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

Copy constructor.

lcs::Clock::~Clock (  ) 

Destructor.


Member Function Documentation

static 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 state change.

static void lcs::Clock::setPulseWidth ( unsigned int  width  )  [static]

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 state change should de-register using this function when notification is no longer required. This function SHOULD be called just 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