src/base/main/main.h File Reference

#include "leaks.h"
#include "extra.h"
#include "vec.h"
#include "st.h"
#include "abc.h"
#include "cmd.h"
#include "io.h"
Include dependency graph for main.h:

Go to the source code of this file.

Typedefs

typedef struct Abc_Frame_t_ Abc_Frame_t

Functions

void Abc_Start ()
void Abc_Stop ()
Abc_Ntk_tAbc_FrameReadNtk (Abc_Frame_t *p)
FILE * Abc_FrameReadOut (Abc_Frame_t *p)
FILE * Abc_FrameReadErr (Abc_Frame_t *p)
bool Abc_FrameReadMode (Abc_Frame_t *p)
bool Abc_FrameSetMode (Abc_Frame_t *p, bool fNameMode)
void Abc_FrameRestart (Abc_Frame_t *p)
bool Abc_FrameShowProgress (Abc_Frame_t *p)
void Abc_FrameSetCurrentNetwork (Abc_Frame_t *p, Abc_Ntk_t *pNet)
void Abc_FrameSwapCurrentAndBackup (Abc_Frame_t *p)
void Abc_FrameReplaceCurrentNetwork (Abc_Frame_t *p, Abc_Ntk_t *pNet)
void Abc_FrameUnmapAllNetworks (Abc_Frame_t *p)
void Abc_FrameDeleteAllNetworks (Abc_Frame_t *p)
void Abc_FrameSetGlobalFrame (Abc_Frame_t *p)
Abc_Frame_tAbc_FrameGetGlobalFrame ()
Vec_Ptr_tAbc_FrameReadStore ()
int Abc_FrameReadStoreSize ()
void * Abc_FrameReadLibLut ()
void * Abc_FrameReadLibGen ()
void * Abc_FrameReadLibSuper ()
void * Abc_FrameReadLibVer ()
void * Abc_FrameReadManDd ()
void * Abc_FrameReadManDec ()
char * Abc_FrameReadFlag (char *pFlag)
bool Abc_FrameIsFlagEnabled (char *pFlag)
void Abc_FrameSetNtkStore (Abc_Ntk_t *pNtk)
void Abc_FrameSetNtkStoreSize (int nStored)
void Abc_FrameSetLibLut (void *pLib)
void Abc_FrameSetLibGen (void *pLib)
void Abc_FrameSetLibSuper (void *pLib)
void Abc_FrameSetLibVer (void *pLib)
void Abc_FrameSetFlag (char *pFlag, char *pValue)

Typedef Documentation

typedef struct Abc_Frame_t_ Abc_Frame_t

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

FileName [main.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [The main package.]

Synopsis [External declarations of the main package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
main.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] TYPEDEFS /// STRUCTURE DEFINITIONS ///

Definition at line 37 of file main.h.


Function Documentation

void Abc_FrameDeleteAllNetworks ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 444 of file mainFrame.c.

00445 {
00446     Abc_Ntk_t * pNtk, * pNtk2;
00447     // delete all the currently saved networks
00448     for ( pNtk  = p->pNtkCur, 
00449           pNtk2 = pNtk? Abc_NtkBackup(pNtk): NULL; 
00450           pNtk; 
00451           pNtk  = pNtk2, 
00452           pNtk2 = pNtk? Abc_NtkBackup(pNtk): NULL )
00453         Abc_NtkDelete( pNtk );
00454     // set the current network empty
00455     p->pNtkCur = NULL;
00456 //    fprintf( p->Out, "All networks have been deleted.\n" );
00457 }

Abc_Frame_t* Abc_FrameGetGlobalFrame (  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 486 of file mainFrame.c.

00487 {
00488         if ( s_GlobalFrame == 0 )
00489         {
00490                 // start the framework
00491                 s_GlobalFrame = Abc_FrameAllocate();
00492                 // perform initializations
00493                 Abc_FrameInit( s_GlobalFrame );
00494         }
00495         return s_GlobalFrame;
00496 }

bool Abc_FrameIsFlagEnabled ( char *  pFlag  ) 

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

Synopsis [Returns 1 if the flag is enabled without value or with value 1.]

Description []

SideEffects []

SeeAlso []

Definition at line 73 of file mainFrame.c.

00074 {
00075     char * pValue;
00076     // if flag is not defined, it is not enabled
00077     pValue = Abc_FrameReadFlag( pFlag );
00078     if ( pValue == NULL )
00079         return 0;
00080     // if flag is defined but value is not empty (no parameter) or "1", it is not enabled
00081     if ( strcmp(pValue, "") && strcmp(pValue, "1") )
00082         return 0;
00083     return 1;
00084 }

FILE* Abc_FrameReadErr ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file mainFrame.c.

00230 {
00231     return p->Err;
00232 }

char* Abc_FrameReadFlag ( char *  pFlag  ) 

Definition at line 54 of file mainFrame.c.

00054 { return Cmd_FlagReadByName( s_GlobalFrame, pFlag );  } 

void* Abc_FrameReadLibGen (  ) 

Definition at line 49 of file mainFrame.c.

00049 { return s_GlobalFrame->pLibGen;      } 

void* Abc_FrameReadLibLut (  ) 

Definition at line 48 of file mainFrame.c.

00048 { return s_GlobalFrame->pLibLut;      } 

void* Abc_FrameReadLibSuper (  ) 

Definition at line 50 of file mainFrame.c.

00050 { return s_GlobalFrame->pLibSuper;    } 

void* Abc_FrameReadLibVer (  ) 

Definition at line 51 of file mainFrame.c.

00051 { return s_GlobalFrame->pLibVer;      } 

void* Abc_FrameReadManDd (  ) 

Definition at line 52 of file mainFrame.c.

void* Abc_FrameReadManDec (  ) 

Definition at line 53 of file mainFrame.c.

bool Abc_FrameReadMode ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file mainFrame.c.

00246 {
00247     int fShortNames;
00248     char * pValue;
00249     pValue = Cmd_FlagReadByName( p, "namemode" );
00250     if ( pValue == NULL )
00251         fShortNames = 0;
00252     else 
00253         fShortNames = atoi(pValue);
00254     return fShortNames;
00255 }

Abc_Ntk_t* Abc_FrameReadNtk ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 197 of file mainFrame.c.

00198 {
00199     return p->pNtkCur;
00200 }

FILE* Abc_FrameReadOut ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 213 of file mainFrame.c.

00214 {
00215     return p->Out;
00216 }

Vec_Ptr_t* Abc_FrameReadStore (  ) 

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

Synopsis [APIs to access parameters in the flobal frame.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file mainFrame.c.

00046 { return s_GlobalFrame->vStore;       } 

int Abc_FrameReadStoreSize (  ) 

Definition at line 47 of file mainFrame.c.

00047 { return Vec_PtrSize(s_GlobalFrame->vStore); }

void Abc_FrameReplaceCurrentNetwork ( Abc_Frame_t p,
Abc_Ntk_t pNtk 
)

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

Synopsis [Replaces the current network by the given one.]

Description [This procedure does not modify the stack of saved networks.]

SideEffects []

SeeAlso []

Definition at line 389 of file mainFrame.c.

00390 {
00391     if ( pNtk == NULL )
00392         return;
00393 
00394     // transfer the parameters to the new network
00395     if ( p->pNtkCur && Abc_FrameIsFlagEnabled( "backup" ) )
00396     {
00397         Abc_NtkSetBackup( pNtk, Abc_NtkBackup(p->pNtkCur) );
00398         Abc_NtkSetStep( pNtk, Abc_NtkStep(p->pNtkCur) );
00399         // delete the current network
00400         Abc_NtkDelete( p->pNtkCur );
00401     }
00402     else
00403     {
00404         Abc_NtkSetBackup( pNtk, NULL );
00405         Abc_NtkSetStep( pNtk, ++p->nSteps );
00406         // delete the current network if present but backup is disabled
00407         if ( p->pNtkCur )
00408             Abc_NtkDelete( p->pNtkCur );
00409     }
00410     // set the new current network
00411     p->pNtkCur = pNtk;
00412 }

void Abc_FrameRestart ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file mainFrame.c.

00166 {
00167 }

void Abc_FrameSetCurrentNetwork ( Abc_Frame_t p,
Abc_Ntk_t pNtkNew 
)

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

Synopsis [Sets the given network to be the current one.]

Description [Takes the network and makes it the current network. The previous current network is attached to the given network as a backup copy. In the stack of backup networks contains too many networks (defined by the paramater "savesteps"), the bottom most network is deleted.]

SideEffects []

SeeAlso []

Definition at line 295 of file mainFrame.c.

00296 {
00297     Abc_Ntk_t * pNtk, * pNtk2, * pNtk3;
00298     int nNetsPresent;
00299     int nNetsToSave;
00300     char * pValue;
00301 
00302     // link it to the previous network
00303     Abc_NtkSetBackup( pNtkNew, p->pNtkCur );
00304     // set the step of this network
00305     Abc_NtkSetStep( pNtkNew, ++p->nSteps );
00306     // set this network to be the current network
00307     p->pNtkCur = pNtkNew;
00308 
00309     // remove any extra network that may happen to be in the stack
00310     pValue = Cmd_FlagReadByName( p, "savesteps" );
00311     // if the value of steps to save is not set, assume 1-level undo
00312     if ( pValue == NULL )
00313         nNetsToSave = 1;
00314     else 
00315         nNetsToSave = atoi(pValue);
00316     
00317     // count the network, remember the last one, and the one before the last one
00318     nNetsPresent = 0;
00319     pNtk2 = pNtk3 = NULL;
00320     for ( pNtk = p->pNtkCur; pNtk; pNtk = Abc_NtkBackup(pNtk2) )
00321     {
00322         nNetsPresent++;
00323         pNtk3 = pNtk2;
00324         pNtk2 = pNtk;
00325     }
00326 
00327     // remove the earliest backup network if it is more steps away than we store
00328     if ( nNetsPresent - 1 > nNetsToSave )
00329     { // delete the last network
00330         Abc_NtkDelete( pNtk2 );
00331         // clean the pointer of the network before the last one
00332         Abc_NtkSetBackup( pNtk3, NULL );
00333     }
00334 }

void Abc_FrameSetFlag ( char *  pFlag,
char *  pValue 
)

Definition at line 60 of file mainFrame.c.

00060 { Cmd_FlagUpdateValue( s_GlobalFrame, pFlag, pValue );  } 

void Abc_FrameSetGlobalFrame ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file mainFrame.c.

00471 {
00472         s_GlobalFrame = p;
00473 }

void Abc_FrameSetLibGen ( void *  pLib  ) 

Definition at line 57 of file mainFrame.c.

00057 { s_GlobalFrame->pLibGen   = pLib;    } 

void Abc_FrameSetLibLut ( void *  pLib  ) 

Definition at line 56 of file mainFrame.c.

00056 { s_GlobalFrame->pLibLut   = pLib;    } 

void Abc_FrameSetLibSuper ( void *  pLib  ) 

Definition at line 58 of file mainFrame.c.

00058 { s_GlobalFrame->pLibSuper = pLib;    } 

void Abc_FrameSetLibVer ( void *  pLib  ) 

Definition at line 59 of file mainFrame.c.

00059 { s_GlobalFrame->pLibVer   = pLib;    } 

bool Abc_FrameSetMode ( Abc_Frame_t p,
bool  fNameMode 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 268 of file mainFrame.c.

00269 {
00270     char Buffer[2];
00271     bool fNameModeOld;
00272     fNameModeOld = Abc_FrameReadMode( p );
00273     Buffer[0] = '0' + fNameMode;
00274     Buffer[1] = 0;
00275     Cmd_FlagUpdateValue( p, "namemode", (char *)Buffer );
00276     return fNameModeOld;
00277 }

void Abc_FrameSetNtkStore ( Abc_Ntk_t pNtk  ) 
void Abc_FrameSetNtkStoreSize ( int  nStored  ) 
bool Abc_FrameShowProgress ( Abc_Frame_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 180 of file mainFrame.c.

00181 {
00182     return Abc_FrameIsFlagEnabled( "progressbar" );
00183 }

void Abc_FrameSwapCurrentAndBackup ( Abc_Frame_t p  ) 

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

Synopsis [This procedure swaps the current and the backup network.]

Description []

SideEffects []

SeeAlso []

Definition at line 347 of file mainFrame.c.

00348 {
00349     Abc_Ntk_t * pNtkCur, * pNtkBack, * pNtkBack2;
00350     int iStepCur, iStepBack;
00351 
00352     pNtkCur  = p->pNtkCur;
00353     pNtkBack = Abc_NtkBackup( pNtkCur );
00354     iStepCur = Abc_NtkStep  ( pNtkCur );
00355 
00356     // if there is no backup nothing to reset
00357     if ( pNtkBack == NULL )
00358         return;
00359 
00360     // remember the backup of the backup
00361     pNtkBack2 = Abc_NtkBackup( pNtkBack );
00362     iStepBack = Abc_NtkStep  ( pNtkBack );
00363 
00364     // set pNtkCur to be the next after the backup's backup
00365     Abc_NtkSetBackup( pNtkCur, pNtkBack2 );
00366     Abc_NtkSetStep  ( pNtkCur, iStepBack );
00367 
00368     // set pNtkCur to be the next after the backup
00369     Abc_NtkSetBackup( pNtkBack, pNtkCur );
00370     Abc_NtkSetStep  ( pNtkBack, iStepCur );
00371 
00372     // set the current network
00373     p->pNtkCur = pNtkBack;
00374 }

void Abc_FrameUnmapAllNetworks ( Abc_Frame_t p  ) 

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

Synopsis [Removes library binding of all currently stored networks.]

Description [This procedure is called when the library is freed.]

SideEffects []

SeeAlso []

Definition at line 425 of file mainFrame.c.

00426 {
00427     Abc_Ntk_t * pNtk;
00428     for ( pNtk = p->pNtkCur; pNtk; pNtk = Abc_NtkBackup(pNtk) )
00429         if ( Abc_NtkHasMapping(pNtk) )
00430             Abc_NtkMapToSop( pNtk );
00431 }

void Abc_Start (  ) 

INCLUDES /// PARAMETERS /// GLOBAL VARIABLES /// MACRO DEFINITIONS /// FUNCTION DEFINITIONS ///

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

Synopsis [Initialization procedure for the library project.]

Description [Note that when Abc_Start() is run in a static library project, it does not load the resource file by default. As a result, ABC is not set up the same way, as when it is run on a command line. For example, some error messages while parsing files will not be produced, and intermediate networks will not be checked for consistancy. One possibility is to load the resource file after Abc_Start() as follows: Abc_UtilsSource( Abc_FrameGetGlobalFrame() );]

SideEffects []

SeeAlso []

Definition at line 253 of file main.c.

00254 {
00255     Abc_Frame_t * pAbc;
00256     // added to detect memory leaks:
00257 #ifdef _DEBUG
00258     _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
00259 #endif
00260     // start the glocal frame
00261     pAbc = Abc_FrameGetGlobalFrame();
00262     // source the resource file
00263 //    Abc_UtilsSource( pAbc );
00264 }

void Abc_Stop (  ) 

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

Synopsis [Deallocation procedure for the library project.]

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file main.c.

00278 {
00279     Abc_Frame_t * pAbc;
00280     pAbc = Abc_FrameGetGlobalFrame();
00281     // perform uninitializations
00282     Abc_FrameEnd( pAbc );
00283     // stop the framework
00284     Abc_FrameDeallocate( pAbc );
00285 }


Generated on Tue Jan 5 12:18:49 2010 for abc70930 by  doxygen 1.6.1