lcs::InputBus< bits > Class Template Reference

#include <inbus.h>

Inheritance diagram for lcs::InputBus< bits >:

lcs::Bus< bits > List of all members.

Detailed Description

template<int bits = 1>
class lcs::InputBus< bits >

A class encapsulating a set of data lines to be used as an input to a 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.

Parameters:
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


Constructor & Destructor Documentation

template<int bits>
lcs::InputBus< bits >::InputBus ( void   ) 

The default constructor. The data lines are all initialised to the lcs::UNKNOWN state.

template<int bits>
lcs::InputBus< bits >::InputBus ( const InputBus< bits > &  bus  ) 

Copy constructor. Performs only a shallow copy. The new InputBus object and bus share the same set of lines.

Parameters:
bus The InputBus object whose lines are used to create a new InputBus object.

template<int bits>
lcs::InputBus< bits >::~InputBus (  )  [virtual]

Destructor.


Member Function Documentation

template<int bits>
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.

Parameters:
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 >.

template<int bits>
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.

Parameters:
line The right operand lcs::Line object.

Reimplemented in lcs::Bus< bits >, lcs::Bus< outBits >, lcs::Bus< inBits >, and lcs::Bus< 1 >.

template<int bits>
template<int w>
const InputBus< w+bits > lcs::InputBus< bits >::operator * ( const InputBus< w > &  bus  )  const

The overloaded operator to join data lines from two busses and form a new bus from these. The right operand bus takes the MSB locations of the new InputBus object.

Parameters:
bits The width of the left-operand bus
w The width of the right operand bus
bus The right operand Bus object.

template<int bits>
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.

template<int bits>
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.

Parameters:
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 >.

template<int bits = 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.


Friends And Related Function Documentation

template<int bits = 1>
friend class InputBus [friend]

InputBus classes of different sizes are friends of each other.


Member Data Documentation

template<int bits = 1>
DataPtr<Line>* lcs::InputBus< bits >::dataPtr [protected]

A pointer to the array of lcs::Line objects encapsulated in an InputBus.


Generated on Sat Oct 14 11:23:40 2006 for libLCS by  doxygen 1.4.7