#include "aig.h"
Go to the source code of this file.
Functions | |
void | Aig_ManOrderStart (Aig_Man_t *p) |
void | Aig_ManOrderStop (Aig_Man_t *p) |
void | Aig_ObjOrderInsert (Aig_Man_t *p, int ObjId) |
void | Aig_ObjOrderRemove (Aig_Man_t *p, int ObjId) |
void | Aig_ObjOrderAdvance (Aig_Man_t *p) |
void Aig_ManOrderStart | ( | Aig_Man_t * | p | ) |
CFile****************************************************************
FileName [aigOrder.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [AIG package.]
Synopsis [Dynamically updated topological order.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - April 28, 2007.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Initializes the order datastructure.]
Description []
SideEffects []
SeeAlso []
Definition at line 42 of file aigOrder.c.
00043 { 00044 Aig_Obj_t * pObj; 00045 int i; 00046 assert( Aig_ManBufNum(p) == 0 ); 00047 // allocate order datastructure 00048 assert( p->pOrderData == NULL ); 00049 p->nOrderAlloc = 2 * Aig_ManObjNumMax(p); 00050 if ( p->nOrderAlloc < (1<<12) ) 00051 p->nOrderAlloc = (1<<12); 00052 p->pOrderData = ALLOC( unsigned, 2 * p->nOrderAlloc ); 00053 memset( p->pOrderData, 0xFF, sizeof(unsigned) * 2 * p->nOrderAlloc ); 00054 // add the constant node 00055 p->pOrderData[0] = p->pOrderData[1] = 0; 00056 p->iPrev = p->iNext = 0; 00057 // add the internal nodes 00058 Aig_ManForEachNode( p, pObj, i ) 00059 Aig_ObjOrderInsert( p, pObj->Id ); 00060 }
void Aig_ManOrderStop | ( | Aig_Man_t * | p | ) |
Function*************************************************************
Synopsis [Deletes the order datastructure.]
Description []
SideEffects []
SeeAlso []
Definition at line 73 of file aigOrder.c.
00074 { 00075 assert( p->pOrderData ); 00076 FREE( p->pOrderData ); 00077 p->nOrderAlloc = 0; 00078 p->iPrev = p->iNext = 0; 00079 }
void Aig_ObjOrderAdvance | ( | Aig_Man_t * | p | ) |
Function*************************************************************
Synopsis [Advances the order forward.]
Description []
SideEffects []
SeeAlso []
Definition at line 159 of file aigOrder.c.
00160 { 00161 assert( p->pOrderData ); 00162 assert( p->pOrderData[2*p->iPrev+1] == (unsigned)p->iNext ); 00163 p->iPrev = p->iNext; 00164 p->nAndPrev++; 00165 }
void Aig_ObjOrderInsert | ( | Aig_Man_t * | p, | |
int | ObjId | |||
) |
Function*************************************************************
Synopsis [Inserts an entry before iNext.]
Description []
SideEffects []
SeeAlso []
Definition at line 92 of file aigOrder.c.
00093 { 00094 int iPrev; 00095 assert( ObjId != 0 ); 00096 assert( Aig_ObjIsNode( Aig_ManObj(p, ObjId) ) ); 00097 if ( ObjId >= p->nOrderAlloc ) 00098 { 00099 int nOrderAlloc = 2 * ObjId; 00100 p->pOrderData = REALLOC( unsigned, p->pOrderData, 2 * nOrderAlloc ); 00101 memset( p->pOrderData + 2 * p->nOrderAlloc, 0xFF, sizeof(unsigned) * 2 * (nOrderAlloc - p->nOrderAlloc) ); 00102 p->nOrderAlloc = nOrderAlloc; 00103 } 00104 assert( p->pOrderData[2*ObjId] == 0xFFFFFFFF ); // prev 00105 assert( p->pOrderData[2*ObjId+1] == 0xFFFFFFFF ); // next 00106 iPrev = p->pOrderData[2*p->iNext]; 00107 assert( p->pOrderData[2*iPrev+1] == (unsigned)p->iNext ); 00108 p->pOrderData[2*ObjId] = iPrev; 00109 p->pOrderData[2*iPrev+1] = ObjId; 00110 p->pOrderData[2*p->iNext] = ObjId; 00111 p->pOrderData[2*ObjId+1] = p->iNext; 00112 p->nAndTotal++; 00113 }
void Aig_ObjOrderRemove | ( | Aig_Man_t * | p, | |
int | ObjId | |||
) |
Function*************************************************************
Synopsis [Removes the entry.]
Description [If iPrev is removed, it slides backward. If iNext is removed, it slides forward.]
SideEffects []
SeeAlso []
Definition at line 127 of file aigOrder.c.
00128 { 00129 int iPrev, iNext; 00130 assert( ObjId != 0 ); 00131 assert( Aig_ObjIsNode( Aig_ManObj(p, ObjId) ) ); 00132 iPrev = p->pOrderData[2*ObjId]; 00133 iNext = p->pOrderData[2*ObjId+1]; 00134 p->pOrderData[2*ObjId] = 0xFFFFFFFF; 00135 p->pOrderData[2*ObjId+1] = 0xFFFFFFFF; 00136 p->pOrderData[2*iNext] = iPrev; 00137 p->pOrderData[2*iPrev+1] = iNext; 00138 if ( p->iPrev == ObjId ) 00139 { 00140 p->nAndPrev--; 00141 p->iPrev = iPrev; 00142 } 00143 if ( p->iNext == ObjId ) 00144 p->iNext = iNext; 00145 p->nAndTotal--; 00146 }