isomatch
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
CircuitTree Class Referenceabstract

#include <circuitTree.h>

Inheritance diagram for CircuitTree:
CircuitAssert CircuitComb CircuitDelay CircuitGroup CircuitTristate

Classes

class  InnerIoIter
 
class  IoIter
 
struct  MemoSign
 

Public Types

enum  CircType {
  CIRC_GROUP, CIRC_COMB, CIRC_DELAY, CIRC_TRI,
  CIRC_ASSERT
}
 

Public Member Functions

 CircuitTree ()
 
virtual ~CircuitTree ()
 
virtual CircType circType () const =0
 
sign_t sign (int level=2)
 
bool equals (CircuitTree *oth)
 
bool operator== (const CircuitTree &oth) const
 
CircuitGroupancestor ()
 
size_t id () const
 
virtual IoIter inp_begin () const =0
 
IoIter inp_end () const
 
virtual IoIter out_begin () const =0
 
virtual IoIter out_end () const =0
 
IoIter io_begin () const
 
IoIter io_end () const
 
virtual size_t inputCount () const =0
 Get the number of inputs. More...
 
virtual size_t outputCount () const =0
 Get the number of outputs. More...
 
virtual WireIdnth_input (size_t circId) const =0
 Get the nth input. More...
 
virtual WireIdnth_output (size_t circId) const =0
 Get the nth input. More...
 
virtual void unplug ()
 Unplug the circuit from its ancestor. More...
 
virtual void toDot (std::basic_ostream< char > &out, int indent=0)=0
 
void alter (bool uprec=true)
 

Protected Types

typedef size_t memo_ts_t
 

Protected Member Functions

virtual sign_t computeSignature (int level)
 
virtual sign_t innerSignature () const =0
 
virtual bool innerEqual (CircuitTree *othTree)=0
 
void unplug_common ()
 Common steps for every overridden implementation of unplug More...
 

Protected Attributes

memo_ts_t curHistoryTime
 Current history "timestamp" for this circuit, used for memoization. More...
 
memo_ts_t lastAlterationTime
 
std::vector< MemoSignmemoSig
 
CircuitGroupancestor_
 

Friends

class CircuitGroup
 

Member Typedef Documentation

◆ memo_ts_t

typedef size_t CircuitTree::memo_ts_t
protected

Member Enumeration Documentation

◆ CircType

Enumerator
CIRC_GROUP 
CIRC_COMB 
CIRC_DELAY 
CIRC_TRI 
CIRC_ASSERT 

Constructor & Destructor Documentation

◆ CircuitTree()

CircuitTree::CircuitTree ( )

◆ ~CircuitTree()

CircuitTree::~CircuitTree ( )
virtual

Member Function Documentation

◆ alter()

void CircuitTree::alter ( bool  uprec = true)

Notify the circuit that its internals have been modified, and its memoized results must be invalidated. This is done automatically on every altering method call. This can nevertheless be called if you want to invalidate memoization.

Parameters
uprecwhether the ancestors' cache should be also invalidated

◆ ancestor()

CircuitGroup* CircuitTree::ancestor ( )
inline

Get the parent group of this circuit. This might be NULL if the group has no parent (yet).

◆ circType()

virtual CircType CircuitTree::circType ( ) const
pure virtual

Returns the tree element's type

Implemented in CircuitGroup, CircuitAssert, CircuitComb, CircuitDelay, and CircuitTristate.

◆ computeSignature()

sign_t CircuitTree::computeSignature ( int  level)
protectedvirtual

Computes the actual signature of the circuit when it was not previously memoized. You should call sign when overriding this function and needing a lower-level signature of a block.

◆ equals()

bool CircuitTree::equals ( CircuitTree oth)

Checks whether this circuit is formally equal to its argument, wrt. permutations, names, etc. This does not take into account the gate's I/O, but only its internal structure.

◆ id()

size_t CircuitTree::id ( ) const
inline

Get this circuit's id

◆ innerEqual()

virtual bool CircuitTree::innerEqual ( CircuitTree othTree)
protectedpure virtual

Computes the actual equality of two gates, assumed of the same type

Implemented in CircuitGroup, CircuitComb, CircuitAssert, CircuitTristate, and CircuitDelay.

◆ innerSignature()

virtual sign_t CircuitTree::innerSignature ( ) const
protectedpure virtual

Computes the inner signature of a gate. This should be reimplemented for every gate type.

Implemented in CircuitGroup, CircuitComb, CircuitAssert, CircuitTristate, and CircuitDelay.

◆ inp_begin()

virtual IoIter CircuitTree::inp_begin ( ) const
pure virtual

Get an iterator to the first input wire

Implemented in CircuitGroup, CircuitAssert, CircuitComb, CircuitDelay, and CircuitTristate.

◆ inp_end()

IoIter CircuitTree::inp_end ( ) const
inline

Get an iterator to the end of input wires

◆ inputCount()

virtual size_t CircuitTree::inputCount ( ) const
pure virtual

Get the number of inputs.

Implemented in CircuitGroup, CircuitComb, CircuitAssert, CircuitTristate, and CircuitDelay.

◆ io_begin()

IoIter CircuitTree::io_begin ( ) const
inline

Get an iterator to the first I/O wire

◆ io_end()

IoIter CircuitTree::io_end ( ) const
inline

Get an iterator to the end of output wires

◆ nth_input()

virtual WireId* CircuitTree::nth_input ( size_t  circId) const
pure virtual

Get the nth input.

Implemented in CircuitGroup, CircuitComb, CircuitAssert, CircuitTristate, and CircuitDelay.

◆ nth_output()

virtual WireId* CircuitTree::nth_output ( size_t  circId) const
pure virtual

Get the nth input.

Implemented in CircuitGroup, CircuitComb, CircuitAssert, CircuitTristate, and CircuitDelay.

◆ operator==()

bool CircuitTree::operator== ( const CircuitTree oth) const
inline

O(1) comparaison using IDs

◆ out_begin()

virtual IoIter CircuitTree::out_begin ( ) const
pure virtual

Get an iterator to the first output wire

Implemented in CircuitGroup, CircuitAssert, CircuitComb, CircuitDelay, and CircuitTristate.

◆ out_end()

virtual IoIter CircuitTree::out_end ( ) const
pure virtual

Get an iterator to the end of output wires

Implemented in CircuitGroup, CircuitAssert, CircuitComb, CircuitDelay, and CircuitTristate.

◆ outputCount()

virtual size_t CircuitTree::outputCount ( ) const
pure virtual

Get the number of outputs.

Implemented in CircuitGroup, CircuitComb, CircuitAssert, CircuitTristate, and CircuitDelay.

◆ sign()

sign_t CircuitTree::sign ( int  level = 2)

Computes the signature of the circuit. Memoized function, it will only be costy on the first run.

Parameters
levelDefines the signature level used. Lower means cheaper, but also less precise.

◆ toDot()

virtual void CircuitTree::toDot ( std::basic_ostream< char > &  out,
int  indent = 0 
)
pure virtual

Generates a Dot representation of the circuit, primarily intended for debugging.

Implemented in CircuitGroup, CircuitAssert, CircuitTristate, and CircuitDelay.

◆ unplug()

void CircuitTree::unplug ( )
virtual

Unplug the circuit from its ancestor.

Unplug the circuit from its ancestor, that is, disconnects every wire. You should delete this circuit right after it has been unplugged, as its internal state is not cleaned up and will most probably break up in mean and inventive ways if you try to reuse it

Reimplemented in CircuitGroup.

◆ unplug_common()

void CircuitTree::unplug_common ( )
protected

Common steps for every overridden implementation of unplug

Friends And Related Function Documentation

◆ CircuitGroup

friend class CircuitGroup
friend

Member Data Documentation

◆ ancestor_

CircuitGroup* CircuitTree::ancestor_
protected

Group this circuit belongs to. This is automatically set.

◆ curHistoryTime

memo_ts_t CircuitTree::curHistoryTime
protected

Current history "timestamp" for this circuit, used for memoization.

◆ lastAlterationTime

memo_ts_t CircuitTree::lastAlterationTime
protected

◆ memoSig

std::vector<MemoSign> CircuitTree::memoSig
protected

The documentation for this class was generated from the following files: