diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-10-22 19:59:52 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-10-22 19:59:52 -0700 |
commit | 103fa663c70fb120ab714e2a0b77fdbcce19ebf9 (patch) | |
tree | f131d3d45866a207f3cfffa24b0963a09f3b6d9d /src/aig/gia/giaUtil.c | |
parent | 1c56475287876a9625642834390e055257499663 (diff) | |
download | abc-103fa663c70fb120ab714e2a0b77fdbcce19ebf9.tar.gz abc-103fa663c70fb120ab714e2a0b77fdbcce19ebf9.tar.bz2 abc-103fa663c70fb120ab714e2a0b77fdbcce19ebf9.zip |
More accurate level calculation in AIG balancing.
Diffstat (limited to 'src/aig/gia/giaUtil.c')
-rw-r--r-- | src/aig/gia/giaUtil.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c index f97dfc86..353edb86 100644 --- a/src/aig/gia/giaUtil.c +++ b/src/aig/gia/giaUtil.c @@ -508,6 +508,54 @@ int Gia_ManLevelNum( Gia_Man_t * p ) /**Function************************************************************* + Synopsis [Assigns levels using CI level information.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Int_t * Gia_ManGetCiLevels( Gia_Man_t * p ) +{ + Vec_Int_t * vCiLevels; + Gia_Obj_t * pObj; + int i; + if ( p->vLevels == NULL ) + return NULL; + vCiLevels = Vec_IntAlloc( Gia_ManCiNum(p) ); + Gia_ManForEachCi( p, pObj, i ) + Vec_IntPush( vCiLevels, Gia_ObjLevel(p, pObj) ); + return vCiLevels; +} +int Gia_ManSetLevels( Gia_Man_t * p, Vec_Int_t * vCiLevels ) +{ + Gia_Obj_t * pObj; + int i; + if ( vCiLevels == NULL ) + return Gia_ManLevelNum( p ); + Gia_ManCleanLevels( p, Gia_ManObjNum(p) ); + p->nLevels = 0; + Gia_ManForEachCi( p, pObj, i ) + { + Gia_ObjSetLevel( p, pObj, Vec_IntEntry(vCiLevels, i) ); + p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) ); + } + Gia_ManForEachObj( p, pObj, i ) + { + if ( Gia_ObjIsAnd(pObj) ) + Gia_ObjSetGateLevel( p, pObj ); + else if ( Gia_ObjIsCo(pObj) ) + Gia_ObjSetCoLevel( p, pObj ); + else continue; + p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) ); + } + return p->nLevels; +} + +/**Function************************************************************* + Synopsis [Compute reverse levels.] Description [] |