- 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 | |
Line (void) | |
Line (const Line &line) | |
virtual | ~Line () |
void | operator= (const LineState &value) |
template<int bits, ExprType Type, typename LExprType, typename RExprType> | |
void | operator= (const Expression< bits, Type, LExprType, RExprType > &expr) |
template<int bits> | |
void | operator= (const InputBus< bits > &bus) |
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 | |
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 | setLineValue (const LineState &value) |
void | setAssDelay (unsigned int delay) |
Friends | |
class | Expression< 1, LINE_EXPR, void, void > |
class | Bus |
class | InputBus |
class | Clock |
lcs::Line::Line | ( | void | ) |
Default constructor.
lcs::Line::Line | ( | const Line & | line | ) |
Copy constructor.
virtual lcs::Line::~Line | ( | ) | [virtual] |
Destructor.
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 InputBus< bits > & | bus | ) | [inline] |
Assignment oparator to facilitate assignment with an lcs::InputBus
object.
void lcs::Line::operator= | ( | const Expression< bits, Type, LExprType, RExprType > & | expr | ) | [inline] |
Assignment operator to facilitate assignment with an expression of bitwise operations.
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::setAssDelay | ( | unsigned int | delay | ) | [inline, private] |
Sets the assignement delay for the line.
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::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 Clock [friend] |
lcs::Clock
is a friend of this class.
friend class Expression< 1, LINE_EXPR, void, void > [friend] |
An expression representing a single line is a friend.
friend class InputBus [friend] |
lcs::InputBus
classes of all sizes are friends of this class.