ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sclSize.c File Reference
#include "sclSize.h"
#include "map/mio/mio.h"
#include "misc/vec/vecWec.h"
#include "base/main/main.h"
Include dependency graph for sclSize.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START Abc_Obj_tAbc_SclFindCriticalCo (SC_Man *p, int *pfRise)
 DECLARATIONS ///.
 
Abc_Obj_tAbc_SclFindMostCriticalFanin2 (SC_Man *p, int *pfRise, Abc_Obj_t *pNode)
 
Abc_Obj_tAbc_SclFindMostCriticalFanin (SC_Man *p, int *pfRise, Abc_Obj_t *pNode)
 
void Abc_SclTimeNtkPrint (SC_Man *p, int fShowAll, int fPrintPath)
 
void Abc_SclTimeNode (SC_Man *p, Abc_Obj_t *pObj, int fDept)
 
void Abc_SclTimeCone (SC_Man *p, Vec_Int_t *vCone)
 
void Abc_SclTimeNtkRecompute (SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
 
void Abc_SclTimeIncCheckLevel (Abc_Ntk_t *pNtk)
 
int Abc_SclTimeIncUpdate (SC_Man *p)
 
void Abc_SclTimeIncInsert (SC_Man *p, Abc_Obj_t *pObj)
 
void Abc_SclTimeIncUpdateLevel_rec (Abc_Obj_t *pObj)
 
void Abc_SclTimeIncUpdateLevel (Abc_Obj_t *pObj)
 
void Abc_SclManReadSlewAndLoad (SC_Man *p, Abc_Ntk_t *pNtk)
 
SC_ManAbc_SclManStart (SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
 
void Abc_SclTimePerformInt (SC_Lib *pLib, Abc_Ntk_t *pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats)
 
void Abc_SclTimePerform (SC_Lib *pLib, Abc_Ntk_t *pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats)
 
int Abc_SclCheckCommonInputs (Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
 
void Abc_SclPrintFaninPairs (SC_Man *p, Abc_Ntk_t *pNtk)
 
int Abc_SclHasBufferFanout (Abc_Obj_t *pObj)
 
int Abc_SclCountBufferFanoutsInt (Abc_Obj_t *pObj)
 
int Abc_SclCountBufferFanouts (Abc_Obj_t *pObj)
 
int Abc_SclCountNonBufferFanoutsInt (Abc_Obj_t *pObj)
 
int Abc_SclCountNonBufferFanouts (Abc_Obj_t *pObj)
 
float Abc_SclCountNonBufferDelayInt (SC_Man *p, Abc_Obj_t *pObj)
 
float Abc_SclCountNonBufferDelay (SC_Man *p, Abc_Obj_t *pObj)
 
float Abc_SclCountNonBufferLoadInt (SC_Man *p, Abc_Obj_t *pObj)
 
float Abc_SclCountNonBufferLoad (SC_Man *p, Abc_Obj_t *pObj)
 
void Abc_SclPrintBuffersOne (SC_Man *p, Abc_Obj_t *pObj, int nOffset)
 
void Abc_SclPrintBuffersInt (SC_Man *p, Abc_Obj_t *pObj, int nOffset)
 
void Abc_SclPrintBufferTrees (SC_Man *p, Abc_Ntk_t *pNtk)
 
void Abc_SclPrintBuffers (SC_Lib *pLib, Abc_Ntk_t *pNtk, int fVerbose)
 

Function Documentation

◆ Abc_SclCheckCommonInputs()

int Abc_SclCheckCommonInputs ( Abc_Obj_t * pObj,
Abc_Obj_t * pFanin )

Function*************************************************************

Synopsis [Printing out fanin information.]

Description []

SideEffects []

SeeAlso []

Definition at line 730 of file sclSize.c.

731{
732 Abc_Obj_t * pTemp;
733 int i;
734 Abc_ObjForEachFanin( pObj, pTemp, i )
735 if ( Abc_NodeFindFanin( pFanin, pTemp ) >= 0 )
736 {
737 printf( "Node %d and its fanin %d have common fanin %d.\n", Abc_ObjId(pObj), Abc_ObjId(pFanin), Abc_ObjId(pTemp) );
738
739 printf( "%-16s : ", Mio_GateReadName((Mio_Gate_t *)pObj->pData) );
740 Abc_ObjPrint( stdout, pObj );
741
742 printf( "%-16s : ", Mio_GateReadName((Mio_Gate_t *)pFanin->pData) );
743 Abc_ObjPrint( stdout, pFanin );
744
745 if ( pTemp->pData )
746 printf( "%-16s : ", Mio_GateReadName((Mio_Gate_t *)pTemp->pData) );
747 Abc_ObjPrint( stdout, pTemp );
748 return 1;
749 }
750 return 0;
751}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
ABC_DLL void Abc_ObjPrint(FILE *pFile, Abc_Obj_t *pObj)
Definition abcPrint.c:1674
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition abcUtil.c:791
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
void * pData
Definition abc.h:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountBufferFanouts()

int Abc_SclCountBufferFanouts ( Abc_Obj_t * pObj)

Definition at line 792 of file sclSize.c.

793{
794 return Abc_SclCountBufferFanoutsInt(pObj) - Abc_ObjIsBuffer(pObj);
795}
int Abc_SclCountBufferFanoutsInt(Abc_Obj_t *pObj)
Definition sclSize.c:783
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountBufferFanoutsInt()

int Abc_SclCountBufferFanoutsInt ( Abc_Obj_t * pObj)

Definition at line 783 of file sclSize.c.

784{
785 Abc_Obj_t * pFanout;
786 int i, Counter = 0;
787 Abc_ObjForEachFanout( pObj, pFanout, i )
788 if ( Abc_ObjIsBuffer(pFanout) )
789 Counter += Abc_SclCountBufferFanoutsInt( pFanout );
790 return Counter + Abc_ObjIsBuffer(pObj);
791}
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountNonBufferDelay()

float Abc_SclCountNonBufferDelay ( SC_Man * p,
Abc_Obj_t * pObj )

Definition at line 825 of file sclSize.c.

826{
827 Abc_Obj_t * pFanout;
828 float Delay = 0;
829 int i;
830 Abc_ObjForEachFanout( pObj, pFanout, i )
831 Delay += Abc_SclCountNonBufferDelayInt( p, pFanout );
832 return Delay;
833}
Cube * p
Definition exorList.c:222
float Abc_SclCountNonBufferDelayInt(SC_Man *p, Abc_Obj_t *pObj)
Definition sclSize.c:814
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountNonBufferDelayInt()

float Abc_SclCountNonBufferDelayInt ( SC_Man * p,
Abc_Obj_t * pObj )

Definition at line 814 of file sclSize.c.

815{
816 Abc_Obj_t * pFanout;
817 float Delay = 0;
818 int i;
819 if ( !Abc_ObjIsBuffer(pObj) )
820 return Abc_SclObjTimeMax(p, pObj);
821 Abc_ObjForEachFanout( pObj, pFanout, i )
822 Delay += Abc_SclCountNonBufferDelayInt( p, pFanout );
823 return Delay;
824}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountNonBufferFanouts()

int Abc_SclCountNonBufferFanouts ( Abc_Obj_t * pObj)

Definition at line 806 of file sclSize.c.

807{
808 Abc_Obj_t * pFanout;
809 int i, Counter = 0;
810 Abc_ObjForEachFanout( pObj, pFanout, i )
811 Counter += Abc_SclCountNonBufferFanoutsInt( pFanout );
812 return Counter;
813}
int Abc_SclCountNonBufferFanoutsInt(Abc_Obj_t *pObj)
Definition sclSize.c:796
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountNonBufferFanoutsInt()

int Abc_SclCountNonBufferFanoutsInt ( Abc_Obj_t * pObj)

Definition at line 796 of file sclSize.c.

797{
798 Abc_Obj_t * pFanout;
799 int i, Counter = 0;
800 if ( !Abc_ObjIsBuffer(pObj) )
801 return 1;
802 Abc_ObjForEachFanout( pObj, pFanout, i )
803 Counter += Abc_SclCountNonBufferFanoutsInt( pFanout );
804 return Counter;
805}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountNonBufferLoad()

float Abc_SclCountNonBufferLoad ( SC_Man * p,
Abc_Obj_t * pObj )

Definition at line 847 of file sclSize.c.

848{
849 Abc_Obj_t * pFanout;
850 float Load = 0;
851 int i;
852 Abc_ObjForEachFanout( pObj, pFanout, i )
853 Load += Abc_SclCountNonBufferLoadInt( p, pFanout );
854 Load += 0.5 * Abc_SclObjLoad(p, pObj)->rise + 0.5 * Abc_SclObjLoad(p, pObj)->fall;
855 return Load;
856}
float Abc_SclCountNonBufferLoadInt(SC_Man *p, Abc_Obj_t *pObj)
Definition sclSize.c:834
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclCountNonBufferLoadInt()

float Abc_SclCountNonBufferLoadInt ( SC_Man * p,
Abc_Obj_t * pObj )

Definition at line 834 of file sclSize.c.

835{
836 Abc_Obj_t * pFanout;
837 float Load = 0;
838 int i;
839 if ( !Abc_ObjIsBuffer(pObj) )
840 return 0;
841 Abc_ObjForEachFanout( pObj, pFanout, i )
842 Load += Abc_SclCountNonBufferLoadInt( p, pFanout );
843 Load += 0.5 * Abc_SclObjLoad(p, pObj)->rise + 0.5 * Abc_SclObjLoad(p, pObj)->fall;
844 Load -= 0.5 * SC_CellPin(Abc_SclObjCell(pObj), 0)->rise_cap + 0.5 * SC_CellPin(Abc_SclObjCell(pObj), 0)->fall_cap;
845 return Load;
846}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclFindCriticalCo()

ABC_NAMESPACE_IMPL_START Abc_Obj_t * Abc_SclFindCriticalCo ( SC_Man * p,
int * pfRise )

DECLARATIONS ///.

CFile****************************************************************

FileName [sclSize.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Standard-cell library representation.]

Synopsis [Core timing analysis used in gate-sizing.]

Author [Alan Mishchenko, Niklas Een]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 24, 2012.]

Revision [

Id
sclSize.c,v 1.0 2012/08/24 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Finding most critical objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file sclSize.c.

53{
54 Abc_Obj_t * pObj, * pPivot = NULL;
55 float fMaxArr = 0;
56 int i;
57 assert( Abc_NtkPoNum(p->pNtk) > 0 );
58 Abc_NtkForEachCo( p->pNtk, pObj, i )
59 {
60 SC_Pair * pArr = Abc_SclObjTime( p, pObj );
61 if ( fMaxArr < pArr->rise ) fMaxArr = pArr->rise, *pfRise = 1, pPivot = pObj;
62 if ( fMaxArr < pArr->fall ) fMaxArr = pArr->fall, *pfRise = 0, pPivot = pObj;
63 }
64 if ( fMaxArr == 0 )
65 pPivot = Abc_NtkPo(p->pNtk, 0);
66 assert( pPivot != NULL );
67 return pPivot;
68}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
struct SC_Pair_ SC_Pair
Definition sclLib.h:69
float fall
Definition sclLib.h:73
float rise
Definition sclLib.h:72
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Abc_SclFindMostCriticalFanin()

Abc_Obj_t * Abc_SclFindMostCriticalFanin ( SC_Man * p,
int * pfRise,
Abc_Obj_t * pNode )

Definition at line 84 of file sclSize.c.

85{
86 Abc_Obj_t * pFanin, * pPivot = NULL;
87 float fMinSlack = ABC_INFINITY;
88 SC_Pair * pArr;
89 int i;
90 *pfRise = 0;
91 // find min-slack node
92 Abc_ObjForEachFanin( pNode, pFanin, i )
93 if ( fMinSlack > Abc_SclObjGetSlack( p, pFanin, p->MaxDelay0 ) )
94 {
95 fMinSlack = Abc_SclObjGetSlack( p, pFanin, p->MaxDelay0 );
96 pPivot = pFanin;
97 }
98 if ( pPivot == NULL )
99 return NULL;
100 // find its leading phase
101 pArr = Abc_SclObjTime( p, pPivot );
102 *pfRise = (pArr->rise >= pArr->fall);
103 return pPivot;
104}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
Here is the caller graph for this function:

◆ Abc_SclFindMostCriticalFanin2()

Abc_Obj_t * Abc_SclFindMostCriticalFanin2 ( SC_Man * p,
int * pfRise,
Abc_Obj_t * pNode )

Definition at line 70 of file sclSize.c.

71{
72 Abc_Obj_t * pFanin, * pPivot = NULL;
73 float fMaxArr = 0;
74 int i;
75 Abc_ObjForEachFanin( pNode, pFanin, i )
76 {
77 SC_Pair * pArr = Abc_SclObjTime( p, pFanin );
78 if ( fMaxArr < pArr->rise ) fMaxArr = pArr->rise, *pfRise = 1, pPivot = pFanin;
79 if ( fMaxArr < pArr->fall ) fMaxArr = pArr->fall, *pfRise = 0, pPivot = pFanin;
80 }
81 return pPivot;
82}

◆ Abc_SclHasBufferFanout()

int Abc_SclHasBufferFanout ( Abc_Obj_t * pObj)

Definition at line 774 of file sclSize.c.

775{
776 Abc_Obj_t * pFanout;
777 int i;
778 Abc_ObjForEachFanout( pObj, pFanout, i )
779 if ( Abc_ObjIsBuffer(pFanout) )
780 return 1;
781 return 0;
782}

◆ Abc_SclManReadSlewAndLoad()

void Abc_SclManReadSlewAndLoad ( SC_Man * p,
Abc_Ntk_t * pNtk )

Function*************************************************************

Synopsis [Read input slew and output load.]

Description []

SideEffects []

SeeAlso []

Definition at line 609 of file sclSize.c.

610{
611 if ( Abc_FrameReadMaxLoad() )
612 {
613 Abc_Obj_t * pObj; int i;
614 float MaxLoad = Abc_FrameReadMaxLoad();
615// printf( "Default output load is specified (%.2f ff).\n", MaxLoad );
616 Abc_NtkForEachPo( pNtk, pObj, i )
617 {
618 SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
619 pLoad->rise = pLoad->fall = MaxLoad;
620 }
621 }
623 {
624 int iCell = Abc_SclCellFind( p->pLib, Abc_FrameReadDrivingCell() );
625 if ( iCell == -1 )
626 printf( "Cannot find the default PI driving cell (%s) in the library.\n", Abc_FrameReadDrivingCell() );
627 else
628 {
629// printf( "Default PI driving cell is specified (%s).\n", Abc_FrameReadDrivingCell() );
630 p->pPiDrive = SC_LibCell( p->pLib, iCell );
631 assert( p->pPiDrive != NULL );
632 assert( p->pPiDrive->n_inputs == 1 );
633 }
634 }
635}
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL float Abc_FrameReadMaxLoad()
Definition mainFrame.c:117
ABC_DLL char * Abc_FrameReadDrivingCell()
Definition mainFrame.c:116
int Abc_SclCellFind(SC_Lib *p, char *pName)
Definition sclLibUtil.c:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclManStart()

SC_Man * Abc_SclManStart ( SC_Lib * pLib,
Abc_Ntk_t * pNtk,
int fUseWireLoads,
int fDept,
float DUser,
int nTreeCRatio )

Function*************************************************************

Synopsis [Prepare timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 648 of file sclSize.c.

649{
650 SC_Man * p = Abc_SclManAlloc( pLib, pNtk );
651 if ( nTreeCRatio )
652 {
653 p->EstLoadMax = 0.01 * nTreeCRatio; // max ratio of Cout/Cave when the estimation is used
654 p->EstLinear = 100; // linear coefficient
655 }
656 Abc_SclMioGates2SclGates( pLib, pNtk );
658 if ( fUseWireLoads )
659 {
660 if ( pNtk->pWLoadUsed == NULL )
661 {
662 p->pWLoadUsed = Abc_SclFindWireLoadModel( pLib, Abc_SclGetTotalArea(p->pNtk) );
663 if ( p->pWLoadUsed )
664 pNtk->pWLoadUsed = Abc_UtilStrsav( p->pWLoadUsed->pName );
665 }
666 else
667 p->pWLoadUsed = Abc_SclFetchWireLoadModel( pLib, pNtk->pWLoadUsed );
668 }
669 Abc_SclTimeNtkRecompute( p, &p->SumArea0, &p->MaxDelay0, fDept, DUser );
670 p->SumArea = p->SumArea0;
671 p->MaxDelay = p->MaxDelay0;
672 return p;
673}
SC_WireLoad * Abc_SclFetchWireLoadModel(SC_Lib *p, char *pName)
Definition sclLibUtil.c:365
SC_WireLoad * Abc_SclFindWireLoadModel(SC_Lib *p, float Area)
Definition sclLibUtil.c:382
void Abc_SclManReadSlewAndLoad(SC_Man *p, Abc_Ntk_t *pNtk)
Definition sclSize.c:609
void Abc_SclTimeNtkRecompute(SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
Definition sclSize.c:415
void Abc_SclMioGates2SclGates(SC_Lib *pLib, Abc_Ntk_t *p)
DECLARATIONS ///.
Definition sclUtil.c:47
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition sclSize.h:44
char * pWLoadUsed
Definition abc.h:209
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclPrintBuffers()

void Abc_SclPrintBuffers ( SC_Lib * pLib,
Abc_Ntk_t * pNtk,
int fVerbose )

Definition at line 912 of file sclSize.c.

913{
914 int fUseWireLoads = 0;
915 SC_Man * p;
916 assert( Abc_NtkIsMappedLogic(pNtk) );
917 p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, 10000 );
918 Abc_SclPrintBufferTrees( p, pNtk );
919// Abc_SclPrintFaninPairs( p, pNtk );
920 Abc_SclManFree( p );
921}
void Abc_SclPrintBufferTrees(SC_Man *p, Abc_Ntk_t *pNtk)
Definition sclSize.c:896
SC_Man * Abc_SclManStart(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
Definition sclSize.c:648
Here is the call graph for this function:

◆ Abc_SclPrintBuffersInt()

void Abc_SclPrintBuffersInt ( SC_Man * p,
Abc_Obj_t * pObj,
int nOffset )

Definition at line 886 of file sclSize.c.

887{
888 Abc_Obj_t * pFanout;
889 int i;
890 Abc_SclPrintBuffersOne( p, pObj, nOffset );
891 assert( Abc_ObjIsBuffer(pObj) );
892 Abc_ObjForEachFanout( pObj, pFanout, i )
893 if ( Abc_ObjIsBuffer(pFanout) )
894 Abc_SclPrintBuffersInt( p, pFanout, nOffset + 1 );
895}
void Abc_SclPrintBuffersOne(SC_Man *p, Abc_Obj_t *pObj, int nOffset)
Definition sclSize.c:857
void Abc_SclPrintBuffersInt(SC_Man *p, Abc_Obj_t *pObj, int nOffset)
Definition sclSize.c:886
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclPrintBuffersOne()

void Abc_SclPrintBuffersOne ( SC_Man * p,
Abc_Obj_t * pObj,
int nOffset )

Definition at line 857 of file sclSize.c.

858{
859 int i;
860 for ( i = 0; i < nOffset; i++ )
861 printf( " " );
862 printf( "%6d: %-16s (%2d:%3d:%3d) ",
863 Abc_ObjId(pObj),
864 Abc_ObjIsPi(pObj) ? "pi" : Mio_GateReadName((Mio_Gate_t *)pObj->pData),
865 Abc_ObjFanoutNum(pObj),
868 for ( ; i < 4; i++ )
869 printf( " " );
870 printf( "a =%5.2f ", Abc_ObjIsPi(pObj) ? 0 : Abc_SclObjCell(pObj)->area );
871 printf( "d = (" );
872 printf( "%6.0f ps; ", Abc_SclObjTimeOne(p, pObj, 1) );
873 printf( "%6.0f ps) ", Abc_SclObjTimeOne(p, pObj, 0) );
874 printf( "l =%5.0f ff ", Abc_SclObjLoadMax(p, pObj) );
875 printf( "s =%5.0f ps ", Abc_SclObjSlewMax(p, pObj) );
876 printf( "sl =%5.0f ps ", Abc_SclObjSlackMax(p, pObj, p->MaxDelay0) );
877 if ( nOffset == 0 )
878 {
879 printf( "L =%5.0f ff ", Abc_SclCountNonBufferLoad(p, pObj) );
880 printf( "Lx =%5.0f ff ", 100.0*Abc_SclCountNonBufferLoad(p, pObj)/p->EstLoadAve );
881 printf( "Dx =%5.0f ps ", Abc_SclCountNonBufferDelay(p, pObj)/Abc_SclCountNonBufferFanouts(pObj) - Abc_SclObjTimeOne(p, pObj, 1) );
882 printf( "Cx =%5.0f ps", (Abc_SclCountNonBufferDelay(p, pObj)/Abc_SclCountNonBufferFanouts(pObj) - Abc_SclObjTimeOne(p, pObj, 1))/log(Abc_SclCountNonBufferLoad(p, pObj)/p->EstLoadAve) );
883 }
884 printf( "\n" );
885}
int Abc_SclCountBufferFanouts(Abc_Obj_t *pObj)
Definition sclSize.c:792
int Abc_SclCountNonBufferFanouts(Abc_Obj_t *pObj)
Definition sclSize.c:806
float Abc_SclCountNonBufferDelay(SC_Man *p, Abc_Obj_t *pObj)
Definition sclSize.c:825
float Abc_SclCountNonBufferLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition sclSize.c:847
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclPrintBufferTrees()

void Abc_SclPrintBufferTrees ( SC_Man * p,
Abc_Ntk_t * pNtk )

Definition at line 896 of file sclSize.c.

897{
898 Abc_Obj_t * pObj, * pFanout;
899 int i, k;
900 Abc_NtkForEachObj( pNtk, pObj, i )
901 {
902 if ( !Abc_ObjIsBuffer(pObj) && Abc_SclCountBufferFanouts(pObj) > 3 )
903 {
904 Abc_SclPrintBuffersOne( p, pObj, 0 );
905 Abc_ObjForEachFanout( pObj, pFanout, k )
906 if ( Abc_ObjIsBuffer(pFanout) )
907 Abc_SclPrintBuffersInt( p, pFanout, 1 );
908 printf( "\n" );
909 }
910 }
911}
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclPrintFaninPairs()

void Abc_SclPrintFaninPairs ( SC_Man * p,
Abc_Ntk_t * pNtk )

Definition at line 752 of file sclSize.c.

753{
754 Abc_Obj_t * pObj, * pFanin;
755 int i, k;
756 Abc_NtkForEachNode( pNtk, pObj, i )
757 Abc_ObjForEachFanin( pObj, pFanin, k )
758 if ( Abc_ObjIsNode(pFanin) && Abc_ObjFanoutNum(pFanin) == 1 )
759 Abc_SclCheckCommonInputs( pObj, pFanin );
760}
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
int Abc_SclCheckCommonInputs(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition sclSize.c:730
Here is the call graph for this function:

◆ Abc_SclTimeCone()

void Abc_SclTimeCone ( SC_Man * p,
Vec_Int_t * vCone )

Definition at line 398 of file sclSize.c.

399{
400 int fVerbose = 0;
401 Abc_Obj_t * pObj;
402 int i;
403 Abc_SclConeClean( p, vCone );
404 Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
405 {
406 if ( fVerbose && Abc_ObjIsNode(pObj) )
407 printf( " Updating node %d with gate %s\n", Abc_ObjId(pObj), Abc_SclObjCell(pObj)->pName );
408 if ( fVerbose && Abc_ObjIsNode(pObj) )
409 printf( " before (%6.1f ps %6.1f ps) ", Abc_SclObjTimeOne(p, pObj, 1), Abc_SclObjTimeOne(p, pObj, 0) );
410 Abc_SclTimeNode( p, pObj, 0 );
411 if ( fVerbose && Abc_ObjIsNode(pObj) )
412 printf( "after (%6.1f ps %6.1f ps)\n", Abc_SclObjTimeOne(p, pObj, 1), Abc_SclObjTimeOne(p, pObj, 0) );
413 }
414}
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition abc.h:455
void Abc_SclTimeNode(SC_Man *p, Abc_Obj_t *pObj, int fDept)
Definition sclSize.c:323
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclTimeIncCheckLevel()

void Abc_SclTimeIncCheckLevel ( Abc_Ntk_t * pNtk)

Definition at line 547 of file sclSize.c.

548{
549 Abc_Obj_t * pObj;
550 int i;
551 Abc_NtkForEachObj( pNtk, pObj, i )
552 if ( (int)pObj->Level != Abc_ObjLevelNew(pObj) )
553 printf( "Level of node %d is out of date!\n", i );
554}
ABC_DLL int Abc_ObjLevelNew(Abc_Obj_t *pObj)
Definition abcTiming.c:1170
unsigned Level
Definition abc.h:142
Here is the call graph for this function:

◆ Abc_SclTimeIncInsert()

void Abc_SclTimeIncInsert ( SC_Man * p,
Abc_Obj_t * pObj )

Definition at line 577 of file sclSize.c.

578{
579 Vec_IntPush( p->vChanged, Abc_ObjId(pObj) );
580}
Here is the caller graph for this function:

◆ Abc_SclTimeIncUpdate()

int Abc_SclTimeIncUpdate ( SC_Man * p)

Definition at line 555 of file sclSize.c.

556{
557 Abc_Obj_t * pObj;
558 int i, RetValue;
559 if ( Vec_IntSize(p->vChanged) == 0 )
560 return 0;
561// Abc_SclTimeIncCheckLevel( p->pNtk );
562 Abc_NtkForEachObjVec( p->vChanged, p->pNtk, pObj, i )
563 {
564 Abc_SclTimeIncAddFanins( p, pObj );
565 if ( pObj->fMarkC )
566 continue;
567 Abc_SclTimeIncAddNode( p, pObj );
568 }
569 Vec_IntClear( p->vChanged );
570 Abc_SclTimeIncUpdateArrival( p );
571 Abc_SclTimeIncUpdateDeparture( p );
572 Abc_SclTimeIncUpdateClean( p );
573 RetValue = p->nIncUpdates;
574 p->nIncUpdates = 0;
575 return RetValue;
576}
unsigned fMarkC
Definition abc.h:136
Here is the caller graph for this function:

◆ Abc_SclTimeIncUpdateLevel()

void Abc_SclTimeIncUpdateLevel ( Abc_Obj_t * pObj)

Definition at line 591 of file sclSize.c.

592{
594}
void Abc_SclTimeIncUpdateLevel_rec(Abc_Obj_t *pObj)
Definition sclSize.c:581
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclTimeIncUpdateLevel_rec()

void Abc_SclTimeIncUpdateLevel_rec ( Abc_Obj_t * pObj)

Definition at line 581 of file sclSize.c.

582{
583 Abc_Obj_t * pFanout;
584 int i, LevelNew = Abc_ObjLevelNew(pObj);
585 if ( LevelNew == (int)pObj->Level && Abc_ObjIsNode(pObj) && Abc_ObjFaninNum(pObj) > 0 )
586 return;
587 pObj->Level = LevelNew;
588 Abc_ObjForEachFanout( pObj, pFanout, i )
590}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclTimeNode()

void Abc_SclTimeNode ( SC_Man * p,
Abc_Obj_t * pObj,
int fDept )

Definition at line 323 of file sclSize.c.

324{
325 SC_Timing * pTime;
326 SC_Cell * pCell;
327 int k;
328 SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
329 float LoadRise = pLoad->rise;
330 float LoadFall = pLoad->fall;
331 float DeptRise = 0;
332 float DeptFall = 0;
333 float Value = p->EstLoadMax ? Abc_SclObjLoadValue( p, pObj ) : 0;
334 Abc_Obj_t * pFanin;
335 if ( Abc_ObjIsCi(pObj) )
336 {
337 assert( !fDept );
338 Abc_SclTimeCi( p, pObj );
339 return;
340 }
341 if ( Abc_ObjIsCo(pObj) )
342 {
343 if ( !fDept )
344 {
345 Abc_SclObjDupFanin( p, pObj );
346 Vec_FltWriteEntry( p->vTimesOut, pObj->iData, Abc_SclObjTimeMax(p, pObj) );
347 Vec_QueUpdate( p->vQue, pObj->iData );
348 }
349 return;
350 }
351 assert( Abc_ObjIsNode(pObj) );
352// if ( !(Abc_ObjFaninNum(pObj) == 1 && Abc_ObjIsPi(Abc_ObjFanin0(pObj))) && p->EstLoadMax && Value > 1 )
353 if ( p->EstLoadMax && Value > 1 )
354 {
355 pLoad->rise = p->EstLoadAve * p->EstLoadMax;
356 pLoad->fall = p->EstLoadAve * p->EstLoadMax;
357 if ( fDept )
358 {
359 SC_Pair * pDepOut = Abc_SclObjDept( p, pObj );
360 float EstDelta = p->EstLinear * log( Value );
361 DeptRise = pDepOut->rise;
362 DeptFall = pDepOut->fall;
363 pDepOut->rise += EstDelta;
364 pDepOut->fall += EstDelta;
365 }
366 p->nEstNodes++;
367 }
368 // get the library cell
369 pCell = Abc_SclObjCell( pObj );
370 // compute for each fanin
371 Abc_ObjForEachFanin( pObj, pFanin, k )
372 {
373 pTime = Scl_CellPinTime( pCell, k );
374 if ( fDept )
375 Abc_SclDeptFanin( p, pTime, pObj, pFanin, k );
376 else
377 Abc_SclTimeFanin( p, pTime, pObj, pFanin, k );
378 }
379 if ( p->EstLoadMax && Value > 1 )
380 {
381 pLoad->rise = LoadRise;
382 pLoad->fall = LoadFall;
383 if ( fDept )
384 {
385 SC_Pair * pDepOut = Abc_SclObjDept( p, pObj );
386 pDepOut->rise = DeptRise;
387 pDepOut->fall = DeptFall;
388 }
389 else
390 {
391 SC_Pair * pArrOut = Abc_SclObjTime( p, pObj );
392 float EstDelta = p->EstLinear * log( Value );
393 pArrOut->rise += EstDelta;
394 pArrOut->fall += EstDelta;
395 }
396 }
397}
struct SC_Timing_ SC_Timing
Definition sclLib.h:124
struct SC_Cell_ SC_Cell
Definition sclLib.h:127
int iData
Definition abc.h:146
Here is the caller graph for this function:

◆ Abc_SclTimeNtkPrint()

void Abc_SclTimeNtkPrint ( SC_Man * p,
int fShowAll,
int fPrintPath )

Definition at line 136 of file sclSize.c.

137{
138 int fReversePath = 1;
139 int i, nLength = 0, fRise = 0;
140 Abc_Obj_t * pObj, * pPivot = Abc_SclFindCriticalCo( p, &fRise );
141 float maxDelay = Abc_SclObjTimeOne( p, pPivot, fRise );
142 p->ReportDelay = maxDelay;
143 // used for Floyds cycle detection algorithm
144 unsigned int tortoiseIndex = 0;
145 int tortoiseStep = 0;
146
147#ifdef WIN32
148 printf( "WireLoad = \"%s\" ", p->pWLoadUsed ? p->pWLoadUsed->pName : "none" );
149 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 14 ); // yellow
150 printf( "Gates =%7d ", Abc_NtkNodeNum(p->pNtk) );
151 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
152 printf( "(%5.1f %%) ", 100.0 * Abc_SclGetBufInvCount(p->pNtk) / Abc_NtkNodeNum(p->pNtk) );
153 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 10 ); // green
154 printf( "Cap =%5.1f ff ", p->EstLoadAve );
155 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
156 printf( "(%5.1f %%) ", Abc_SclGetAverageSize(p->pNtk) );
157 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 11 ); // blue
158 printf( "Area =%12.2f ", Abc_SclGetTotalArea(p->pNtk) );
159 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
160 printf( "(%5.1f %%) ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) );
161 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 13 ); // magenta
162 printf( "Delay =%9.2f ps ", maxDelay );
163 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
164 printf( "(%5.1f %%) ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) );
165 printf( " \n" );
166#else
167 Abc_Print( 1, "WireLoad = \"%s\" ", p->pWLoadUsed ? p->pWLoadUsed->pName : "none" );
168 Abc_Print( 1, "%sGates =%7d%s ", "\033[1;33m", Abc_NtkNodeNum(p->pNtk), "\033[0m" ); // yellow
169 Abc_Print( 1, "(%5.1f %%) ", 100.0 * Abc_SclGetBufInvCount(p->pNtk) / Abc_NtkNodeNum(p->pNtk) );
170 Abc_Print( 1, "%sCap =%5.1f ff%s ", "\033[1;32m", p->EstLoadAve, "\033[0m" ); // green
171 Abc_Print( 1, "(%5.1f %%) ", Abc_SclGetAverageSize(p->pNtk) );
172 Abc_Print( 1, "%sArea =%12.2f%s ", "\033[1;36m", Abc_SclGetTotalArea(p->pNtk), "\033[0m" ); // blue
173 Abc_Print( 1, "(%5.1f %%) ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) );
174 Abc_Print( 1, "%sDelay =%9.2f ps%s ", "\033[1;35m", maxDelay, "\033[0m" ); // magenta
175 Abc_Print( 1, "(%5.1f %%) ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) );
176 Abc_Print( 1, " \n" );
177#endif
178
179 if ( fShowAll )
180 {
181// printf( "Timing information for all nodes: \n" );
182 // find the longest cell name
183 Abc_NtkForEachNodeReverse( p->pNtk, pObj, i )
184 if ( Abc_ObjFaninNum(pObj) > 0 )
185 nLength = Abc_MaxInt( nLength, strlen(Abc_SclObjCell(pObj)->pName) );
186 // print timing
187 Abc_NtkForEachNodeReverse( p->pNtk, pObj, i )
188 if ( Abc_ObjFaninNum(pObj) > 0 )
189 Abc_SclTimeNodePrint( p, pObj, -1, nLength, maxDelay );
190 }
191 if ( fPrintPath )
192 {
193 Abc_Obj_t * pTemp, * pPrev = NULL;
194 int iStart = -1, iEnd = -1;
195 Vec_Ptr_t * vPath;
196// printf( "Critical path: \n" );
197 // find the longest cell name
198 pObj = Abc_ObjFanin0(pPivot);
199 i = 0;
200 while ( pObj && Abc_ObjIsNode(pObj) )
201 {
202 i++;
203 nLength = Abc_MaxInt( nLength, Abc_SclObjCell(pObj) ? strlen(Abc_SclObjCell(pObj)->pName) : 2 /* strlen("pi") */ );
204 pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
205 }
206
207 // print timing
208 if ( !fReversePath )
209 {
210 // print timing
211 pObj = Abc_ObjFanin0(pPivot);
212 while ( pObj )//&& Abc_ObjIsNode(pObj) )
213 {
214 printf( "Path%3d --", i-- );
215 Abc_SclTimeNodePrint( p, pObj, fRise, nLength, maxDelay );
216 pPrev = pObj;
217 pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
218 }
219 }
220 else
221 {
222 // collect path nodes
223 vPath = Vec_PtrAlloc( 100 );
224 Vec_PtrPush( vPath, pPivot );
225 pObj = Abc_ObjFanin0(pPivot);
226 while ( pObj )//&& Abc_ObjIsNode(pObj) )
227 {
228 Vec_PtrPush( vPath, pObj );
229 pPrev = pObj;
230 pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
231
232 // move the tortoise at half the speed (trailing)
233 tortoiseStep = (tortoiseStep + 1) % 2;
234 tortoiseIndex += tortoiseStep;
235 // if they see the same element, we are in a loop
236 if(vPath->pArray[tortoiseIndex] == pObj) {
237 break;
238 }
239 }
240 Vec_PtrForEachEntryReverse( Abc_Obj_t *, vPath, pObj, i )
241 {
242 printf( "Path%3d --", Vec_PtrSize(vPath)-1-i );
243 Abc_SclTimeNodePrint( p, pObj, fRise, nLength, maxDelay );
244 if ( i == 1 )
245 break;
246 }
247 Vec_PtrFree( vPath );
248 }
249 // print start-point and end-point
250 Abc_NtkForEachPi( p->pNtk, pTemp, iStart )
251 if ( pTemp == pPrev )
252 break;
253 Abc_NtkForEachPo( p->pNtk, pTemp, iEnd )
254 if ( pTemp == pPivot )
255 break;
256 printf( "Start-point = pi%0*d. End-point = po%0*d.\n",
257 Abc_Base10Log( Abc_NtkPiNum(p->pNtk) ), iStart,
258 Abc_Base10Log( Abc_NtkPoNum(p->pNtk) ), iEnd );
259 }
260}
#define Abc_NtkForEachNodeReverse(pNtk, pNode, i)
Definition abc.h:476
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
ABC_NAMESPACE_IMPL_START Abc_Obj_t * Abc_SclFindCriticalCo(SC_Man *p, int *pfRise)
DECLARATIONS ///.
Definition sclSize.c:52
Abc_Obj_t * Abc_SclFindMostCriticalFanin(SC_Man *p, int *pfRise, Abc_Obj_t *pNode)
Definition sclSize.c:84
int Abc_SclCountMinSize(SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax)
Definition sclUtil.c:222
int Abc_SclCountNearCriticalNodes(SC_Man *p)
Definition sclUpsize.c:187
int strlen()
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition vecPtr.h:63
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclTimeNtkRecompute()

void Abc_SclTimeNtkRecompute ( SC_Man * p,
float * pArea,
float * pDelay,
int fReverse,
float DUser )

Definition at line 415 of file sclSize.c.

416{
417 Abc_Obj_t * pObj;
418 float D;
419 int i;
421 Abc_SclManCleanTime( p );
422 p->nEstNodes = 0;
423 Abc_NtkForEachCi( p->pNtk, pObj, i )
424 Abc_SclTimeNode( p, pObj, 0 );
425 Abc_NtkForEachNode1( p->pNtk, pObj, i )
426 Abc_SclTimeNode( p, pObj, 0 );
427 Abc_NtkForEachCo( p->pNtk, pObj, i )
428 Abc_SclTimeNode( p, pObj, 0 );
429 D = Abc_SclReadMaxDelay( p );
430 if ( fReverse && DUser > 0 && D < DUser )
431 D = DUser;
432 if ( pArea )
433 *pArea = Abc_SclGetTotalArea(p->pNtk);
434 if ( pDelay )
435 *pDelay = D;
436 if ( fReverse )
437 {
438 p->nEstNodes = 0;
439 Abc_NtkForEachNodeReverse1( p->pNtk, pObj, i )
440 Abc_SclTimeNode( p, pObj, 1 );
441 }
442}
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition abc.h:470
#define Abc_NtkForEachNodeReverse1(pNtk, pNode, i)
Definition abc.h:479
void Abc_SclComputeLoad(SC_Man *p)
Definition sclLoad.c:108
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclTimePerform()

void Abc_SclTimePerform ( SC_Lib * pLib,
Abc_Ntk_t * pNtk,
int nTreeCRatio,
int fUseWireLoads,
int fShowAll,
int fPrintPath,
int fDumpStats )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 707 of file sclSize.c.

708{
709 Abc_Ntk_t * pNtkNew = pNtk;
710 if ( pNtk->nBarBufs2 > 0 )
711 pNtkNew = Abc_NtkDupDfsNoBarBufs( pNtk );
712 Abc_SclTimePerformInt( pLib, pNtkNew, nTreeCRatio, fUseWireLoads, fShowAll, fPrintPath, fDumpStats );
713 if ( pNtk->nBarBufs2 > 0 )
714 Abc_NtkDelete( pNtkNew );
715}
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfsNoBarBufs(Abc_Ntk_t *pNtk)
Definition abcNtk.c:578
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
void Abc_SclTimePerformInt(SC_Lib *pLib, Abc_Ntk_t *pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats)
Definition sclSize.c:686
int nBarBufs2
Definition abc.h:175
Here is the call graph for this function:

◆ Abc_SclTimePerformInt()

void Abc_SclTimePerformInt ( SC_Lib * pLib,
Abc_Ntk_t * pNtk,
int nTreeCRatio,
int fUseWireLoads,
int fShowAll,
int fPrintPath,
int fDumpStats )

Function*************************************************************

Synopsis [Printing out timing information for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 686 of file sclSize.c.

687{
688 SC_Man * p;
689 p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, nTreeCRatio );
690 Abc_SclTimeNtkPrint( p, fShowAll, fPrintPath );
691 if ( fDumpStats )
692 Abc_SclDumpStats( p, "stats.txt", 0 );
693 Abc_SclManFree( p );
694}
void Abc_SclTimeNtkPrint(SC_Man *p, int fShowAll, int fPrintPath)
Definition sclSize.c:136
Here is the call graph for this function:
Here is the caller graph for this function: