#include <inbus.h>
Inheritance diagram for lcs::InputBus< bits >:
lcs::Module
object. A client can only read the data lines and cannot set/modify them. Use the class lcs::Bus
in order to obtain lines whose levels can be set by a client.
bits | The number of data lines in the bus. |
Public Member Functions | |
InputBus (void) | |
InputBus (const InputBus< bits > &bus) | |
virtual | ~InputBus () |
int | width (void) |
void | drive (Module *mod) |
void | unDrive (Module *mod) |
const LineState | operator[] (int i) const throw (OutOfRangeException<int>) |
template<int w> | |
const InputBus< w+bits > | operator * (const InputBus< w > &bus) const |
const InputBus< bits+1 > | operator * (const Line &line) const |
Protected Attributes | |
DataPtr< Line > * | dataPtr |
Friends | |
class | InputBus |
lcs::InputBus< bits >::InputBus | ( | void | ) |
The default constructor. The data lines are all initialised to the lcs::UNKNOWN state.
lcs::InputBus< bits >::InputBus | ( | const InputBus< bits > & | bus | ) |
lcs::InputBus< bits >::~InputBus | ( | ) | [virtual] |
Destructor.
void lcs::InputBus< bits >::drive | ( | Module * | mod | ) |
Registers the module which has to be driven. Every module which intends to be driven by an InputBus
will have to register itself using this function.
This function typically needs to be used only module implementors in the constructors of their lcs::Module derivatives. Other users will never need to use this function.
mod | Pointer to the lcs::Module object which has to be driven. |
Reimplemented in lcs::Bus< bits >, lcs::Bus< outBits >, lcs::Bus< inBits >, and lcs::Bus< 1 >.
const InputBus< bits+1 > lcs::InputBus< bits >::operator * | ( | const Line & | line | ) | const |
The overloaded operator to join a data line to a bus to form a new bus. The line to be joined will have to be the right operand. The joined line takes the MSB location in the resulting InputBus object.
line | The right operand lcs::Line object. |
Reimplemented in lcs::Bus< bits >, lcs::Bus< outBits >, lcs::Bus< inBits >, and lcs::Bus< 1 >.
const InputBus< w+bits > lcs::InputBus< bits >::operator * | ( | const InputBus< w > & | bus | ) | const |
const LineState lcs::InputBus< bits >::operator[] | ( | int | i | ) | const throw (OutOfRangeException<int>) |
Overloaded operator which returns a const lcs::LineState variable corresponding to the state of the line at index i
. An OutOfRangeException
is thrown if the index value i
is beyond the bus width. The returned value is only a copy of the line state.
void lcs::InputBus< bits >::unDrive | ( | Module * | mod | ) |
De-registers a module from the list of modules which have to be driven. See InputBus::drive for more details.
This function typically needs to be used only module implementors in the destructors of their lcs::Module derivatives. Other users will never need to use this function.
mod | Pointer to the lcs::Module object which has to be de-registered from being driven by the bus. |
Reimplemented in lcs::Bus< bits >, lcs::Bus< outBits >, lcs::Bus< inBits >, and lcs::Bus< 1 >.
int lcs::InputBus< bits >::width | ( | void | ) | [inline] |
Returns the bus width. Bus width is the same as the number of data lines in the bus.
friend class InputBus [friend] |
InputBus classes of different sizes are friends of each other.
DataPtr<Line>* lcs::InputBus< bits >::dataPtr [protected] |