- A Logic Circuit Simulation Library in C++





lcs::FullAdder Class Reference

#include <fa.h>

Inheritance diagram for lcs::FullAdder:

lcs::Module List of all members.

Detailed Description

A class which encapsulates a 1-bit full-adder.


Public Member Functions

 FullAdder (const Bus< 1 > &S, const Bus< 1 > Cout, const InputBus< 1 > &A, const InputBus< 1 > &B, const InputBus< 1 > &Cin)
 ~FullAdder ()
virtual void onStateChange (int portId)

Static Public Attributes

static const int A_IN = 0
static const int B_IN = 1
static const int C_IN = 2


Constructor & Destructor Documentation

lcs::FullAdder::FullAdder ( const Bus< 1 > &  S,
const Bus< 1 >  Cout,
const InputBus< 1 > &  A,
const InputBus< 1 > &  B,
const InputBus< 1 > &  Cin 
)

The only meaningfull constructor for the class. A default constructor is not explicitly provided. Moreover, the one synthesized by the compiler (if at all) is practically useless.

Parameters:
S The single line output Bus which carries the sum.
Cout The single line output Bus which carries the carry output.
A The single line InputBus object which carries one of the data lines.
B The single line InputBus object which carries the other data line.
Cin The single line InputBus object which carries the carry input to the full-adder.

lcs::FullAdder::~FullAdder (  ) 

Destructor.


Member Function Documentation

virtual void lcs::FullAdder::onStateChange ( int  portId  )  [virtual]

This function is triggered by the inputs to the fulladder whenever their states change. When triggered, binary 1-bit addition is performed on the line states of input busses and the result is propogated to the output busses.

Reimplemented from lcs::Module.


Member Data Documentation

const int lcs::FullAdder::A_IN = 0 [static]

A static integer id to denote one of the inputs to the fulladder.

const int lcs::FullAdder::B_IN = 1 [static]

A static integer id to denote one of the inputs to the fulladder.

const int lcs::FullAdder::C_IN = 2 [static]

A static integer id to denote the carry input to the fulladder.


Copyright © 2006, 2007 Siva Chandra