lcs::Bus< bits > Class Template Reference

#include <bus.h>

Inheritance diagram for lcs::Bus< bits >:

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

Detailed Description

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

A class encapsulating a set of data lines to be used as a generic bus in logic circuit systems. The data lines are conceptially organised in the little endian format. A user can set and read the individual data lines of the bus. There are overloaded operators provided which can be used to join two busses, or join a line to a bus.

Parameters:
bits The number of data lines in the bus.


Public Member Functions

 Bus (void)
 Bus (const Bus< bits > &bus)
virtual ~Bus ()
Lineoperator[] (int index)
template<int w>
const Bus< w+bits > operator * (const Bus< w > &bus) const
const Bus< bits+1 > operator * (const Line &line) const
void operator= (int value)

Private Member Functions

void drive (Module *mod)
void unDrive (Module *mod)

Friends

class Bus


Constructor & Destructor Documentation

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

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

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

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

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

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

Destructor.


Member Function Documentation

template<int bits = 1>
void lcs::Bus< bits >::drive ( Module mod  )  [inline, private]

This function is inherited from InputBus. However, it has been declared private so that the user is prevented from using a Bus object to drive/un-drive a module.

Reimplemented from lcs::InputBus< bits >.

template<int bits>
const Bus< bits+1 > lcs::Bus< 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 Bus object.

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

Reimplemented from lcs::InputBus< bits >.

template<int bits>
template<int w>
const Bus< w+bits > lcs::Bus< bits >::operator * ( const Bus< 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.

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>
void lcs::Bus< bits >::operator= ( int  value  ) 

The assignment operator which sets the data lines to a binary equivalent of the decimal argument value.

Parameters:
value The decimal equivalent of the binary value which has to be set.

template<int bits>
Line & lcs::Bus< bits >::operator[] ( int  index  ) 

The operator which can be used to read and write data onto the lines of the bus.

Parameters:
index The index of the data line in the bus. Note that all data in libLCS is stored in the little-endian format.

template<int bits = 1>
void lcs::Bus< bits >::unDrive ( Module mod  )  [inline, private]

This function is inherited from InputBus. However, it has been declared private so that the user is prevented from using a Bus object to drive/un-drive a module.

Reimplemented from lcs::InputBus< bits >.


Friends And Related Function Documentation

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

Bus classes of other sizes are friends of this class.


Generated on Wed Sep 20 00:49:12 2006 for libLCS by  doxygen 1.4.7