- A Logic Circuit Simulation Library in C++





lcs::BitBuff< bits > Class Template Reference

#include <bitbuff.h>

Inheritance diagram for lcs::BitBuff< bits >:

lcs::Array1D< T, len > List of all members.

Detailed Description

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

A utility class which encapsulates a group of lcs::Bit objects. Objects of this class should typically be used as temporary/intermediate data storage buffers.


Public Member Functions

 BitBuff (void)
 BitBuff (const BitBuff< bits > &reg)
virtual ~BitBuff ()
template<int w>
const BitBuff< w > partSelect (int s)
void notify (Module *mod, int bit=-1)
void stopNotification (Module *mod, int bit=-1)
int width (void)
unsigned long toInt (void) const
std::string toStr (void) const
template<int rbits>
BitBuff< bits > & operator= (const BitBuff< rbits > &rhs)
template<int w, ExprType Type, typename LExprType, typename RExprType>
BitBuff< bits > & operator= (const Expression< w, Type, LExprType, RExprType > &expr)
template<int rbits>
BitBuff< bits > & operator= (const InputBus< rbits > &rhs)
const Expression< 1, BITBUFF_EXPR,
void, void > 
operator[] (int index) const throw (OutOfRangeException<int>)
Expression< 1, BITBUFF_EXPR,
void, void > 
operator[] (int index) throw (OutOfRangeException<int>)


Constructor & Destructor Documentation

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

Default constructor.

template<int bits>
lcs::BitBuff< bits >::BitBuff ( const BitBuff< bits > &  reg  ) 

Copy constructor.

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

Destructor.


Member Function Documentation

template<int bits>
void lcs::BitBuff< bits >::notify ( Module mod,
int  bit = -1 
)

Registers the module which has to be notified about a bit state change.

Parameters:
mod Pointer to the module object which seeks to be notified about a bit state change.
bit The index of the bit whose state change should be notified to the module.

template<int bits>
template<int rbits>
BitBuff< bits > & lcs::BitBuff< bits >::operator= ( const InputBus< rbits > &  rhs  ) 

Assignment operator to facilitate assignment using a lcs::InputBus object.

template<int bits>
template<int w, ExprType Type, typename LExprType, typename RExprType>
BitBuff< bits > & lcs::BitBuff< bits >::operator= ( const Expression< w, Type, LExprType, RExprType > &  expr  ) 

Assignment operator to facilitate assignment using an lcs::Expression object. ie., the operator facilitates assignment with an expression of bitwise operations on the right hand side of the assignment operator.

template<int bits>
template<int rbits>
BitBuff< bits > & lcs::BitBuff< bits >::operator= ( const BitBuff< rbits > &  rhs  ) 

Assignment operator.

template<int bits>
Expression< 1, BITBUFF_EXPR, void, void > lcs::BitBuff< bits >::operator[] ( int  index  )  throw (OutOfRangeException<int>)

Returns a the suitable expression object when a bitselect is requested. An expression object is returned so that a bitselect can be used in a normal expression of bitwise operations.

template<int bits>
const Expression< 1, BITBUFF_EXPR, void, void > lcs::BitBuff< bits >::operator[] ( int  index  )  const throw (OutOfRangeException<int>)

Returns a the suitable constant expression object when a bitselect is requested. An expression object is returned so that a bitselect can be used in a normal expression of bitwise operations.

template<int bits>
template<int w>
const BitBuff< w > lcs::BitBuff< bits >::partSelect ( int  s  ) 

Returns a part-buffer formed from a set of consecutive bits of the original BitBuffer object. If s+w goes beyond the range of the original bus width, then, only the bits within range are assigned to the bits of the new bus object.

Parameters:
w The width of the part-buffer.
s The start bit from where the part-buffer should be accumulated.

template<int bits>
void lcs::BitBuff< bits >::stopNotification ( Module mod,
int  bit = -1 
)

De-registers a module from the list of modules which have to be notified of bit state changes.

Parameters:
mod Pointer to the module object which seeks to de-register.
bit The index of the bit whose state change was being notified to the module.

template<int bits>
unsigned long lcs::BitBuff< bits >::toInt ( void   )  const

Converts the binary bit value in the buffer to a decimal integer.

template<int bits>
std::string lcs::BitBuff< bits >::toStr ( void   )  const

Converts the binary bit value in the buffer to a string representation.

template<int bits = 1>
int lcs::BitBuff< bits >::width ( void   )  [inline]

Returns the width of the buffer.


Copyright © 2006, 2007 Siva Chandra