|
|
- A Logic Circuit Simulation Library in C++ |
#include <line.h>
Line object is used to denote one bit of a lcs::Bus and lcs::InputBus objects. Various operators are supported to facilitate bit operations on Line objects.
Public Member Functions | |
| bool | isLocked (void) |
| Bus< 1 > | makeBus (void) |
| void | operator= (const LineState &value) |
| const LineState | operator() (void) const |
| const LineState | operator| (const Line &line) const |
| const LineState | operator & (const Line &line) const |
| const LineState | operator^ (const Line &line) const |
| bool | operator== (const LineState &state) const |
| bool | operator!= (const LineState &state) const |
| void | update (void) |
Private Member Functions | |
| Line (void) | |
| Line (const Line &line) | |
| virtual | ~Line () |
| const Line & | operator= (const Line &line) |
| void | notify (const LineEvent &event, Module *mod, const int &portId) |
| void | stopNotification (const LineEvent &event, Module *mod, const int &portId) |
| void | lock (Module *mod, unsigned int delay) |
| void | unLock (Module *mod) |
| void | setLineValue (const LineState &value) |
Friends | |
| class | Bus |
| class | InputBus |
| lcs::Line::Line | ( | void | ) | [private] |
Default constructor.
| lcs::Line::Line | ( | const Line & | line | ) | [private] |
Copy constructor.
| virtual lcs::Line::~Line | ( | ) | [private, virtual] |
Destructor.
| bool lcs::Line::isLocked | ( | void | ) |
Returns true if the line is locked, else returns false .
| void lcs::Line::lock | ( | Module * | mod, | |
| unsigned int | delay | |||
| ) | [private] |
This function locks a lcs::Line object for use with only that lcs::Module derivative which has locked the it. Since it is declared private, it cannot be used directly. One has to use lcs::Bus::lock instead.
One can also set assignment delay associated with the line using this function. Again, this feature cannot be used directly and one will have to use lcs::Bus::lock instead.
| mod | The pointer to an module object (which is an instance of a derivative of lcs::Module class) by which the line should be locked. | |
| delay | The assignment delay associated with the line. |
A lcs::Module (or its derivative) should register to be notified by the line about line events using this function. However, since this function is declared as a private member, one cannot use this function directly. See lcs::InputBus::notify for more information. The lcs::Line::notify is called by the function lcs::InputBus::notify.
| event | The event of whose occurance the module should be notified of. | |
| mod | Pointer to the lcs::Module object which has to be driven by the line. | |
| portId | The id of the module port to which the line is connected. |
Overloaded bit AND operator. Performs a AND operation of the line states of two Line objects.
| bool lcs::Line::operator!= | ( | const LineState & | state | ) | const [inline] |
Overloaded logical inequality operator. Compares the line state with a LineState variable.
| state | The LineState variable with which the comparison should be made. |
| const LineState lcs::Line::operator() | ( | void | ) | const [inline] |
Returns the line state.
| void lcs::Line::operator= | ( | const LineState & | value | ) |
Overloaded assignment operator which sets the line state with a LineState variable.
| value | The value to which the line state should be changed. |
| bool lcs::Line::operator== | ( | const LineState & | state | ) | const [inline] |
Overloaded logical equality operator. Compares the line state with a LineState variable.
| state | The LineState variable with which the comparison should be made. |
Overloaded bit XOR operator. Performs a XOR operation of the line states of two Line objects.
Overloaded bit OR operator. Performs a OR operation of the line states of two Line objects.
| void lcs::Line::setLineValue | ( | const LineState & | value | ) | [private] |
This is an internal function used by other functions of this class. As it is declared as private, a user of libLCS will never require to use this function.
| void lcs::Line::stopNotification | ( | const LineEvent & | event, | |
| Module * | mod, | |||
| const int & | portId | |||
| ) | [private] |
A lcs::Module (or its derivative) can de-register itself from being driven by the line using this function. See lcs::Line::notify for more information. As with lcs::Line::notify, even this function is declared private and hence cannot be used directly. One has to use lcs::Bus::stopNotification, which internally makes a call to lcs::Line::stopNotification.
| event | The event of whose occurance the module was being notified of. | |
| mod | Pointer to the lcs::Module object which should be de-registered from being notifed by the line. | |
| portId | The id of the module port to which the line is connected. |
| void lcs::Line::unLock | ( | Module * | mod | ) | [private] |
This functions unLocks a line from a module. Since it is declared private, it cannot be used directly. One has to use lcs::Bus::unLock instead. See lcs::Line::lock for more information.
| mod | The pointer to an module object (which is an instance of a derivative of lcs::Module class) with which the line was locked earlier. |
| void lcs::Line::update | ( | void | ) |
This function is used by the system time keeper to notify the line to let it update it's state after a certain delay. Under normal circumstances, a user of libLCS will never require to call this function.
friend class InputBus [friend] |
lcs::InputBus classes of all sizes are friends of this class.