mirror of https://github.com/YosysHQ/abc.git
New command &init1.
This commit is contained in:
parent
71e163571a
commit
29656286cf
|
|
@ -656,6 +656,40 @@ Gia_Man_t * Gia_ManDupFlip( Gia_Man_t * p, int * pInitState )
|
|||
return pNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Complements some flops without duplicating AIG.]
|
||||
|
||||
Description [The array of integers containing the initial state
|
||||
of each flop in the AIG.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_ManFlipInit1( Gia_Man_t * p, Vec_Int_t * vInit )
|
||||
{
|
||||
Gia_Obj_t * pObj; int c;
|
||||
assert( Gia_ManRegNum(p) == Vec_IntSize(vInit) );
|
||||
Gia_ManForEachRo( p, pObj, c )
|
||||
pObj->fMark0 = (int)(Vec_IntEntry(vInit, c) == 1);
|
||||
Gia_ManForEachAnd( p, pObj, c ) {
|
||||
if ( Gia_ObjFanin0(pObj)->fMark0 )
|
||||
pObj->fCompl0 ^= 1;
|
||||
if ( Gia_ObjFanin1(pObj)->fMark0 )
|
||||
pObj->fCompl1 ^= 1;
|
||||
}
|
||||
Gia_ManForEachCo( p, pObj, c )
|
||||
if ( Gia_ObjFanin0(pObj)->fMark0 )
|
||||
pObj->fCompl0 ^= 1;
|
||||
Gia_ManForEachRo( p, pObj, c )
|
||||
pObj->fMark0 = 0;
|
||||
Gia_ManForEachRi( p, pObj, c )
|
||||
if ( Vec_IntEntry(vInit, c) == 1 )
|
||||
pObj->fCompl0 ^= 1;
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
|
|
|
|||
|
|
@ -635,6 +635,7 @@ static int Abc_CommandAbc9Gen ( Abc_Frame_t * pAbc, int argc, cha
|
|||
static int Abc_CommandAbc9Cfs ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9ProdAdd ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9AddFlop ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Init1 ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9BMiter ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9GenHie ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9PutOnTop ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
|
@ -1477,6 +1478,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
|
|||
Cmd_CommandAdd( pAbc, "ABC9", "&cfs", Abc_CommandAbc9Cfs, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&prodadd", Abc_CommandAbc9ProdAdd, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&addflop", Abc_CommandAbc9AddFlop, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&init1", Abc_CommandAbc9Init1, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&bmiter", Abc_CommandAbc9BMiter, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&gen_hie", Abc_CommandAbc9GenHie, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&putontop", Abc_CommandAbc9PutOnTop, 0 );
|
||||
|
|
@ -57029,6 +57031,59 @@ usage:
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandAbc9Init1( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
extern void Gia_ManFlipInit1( Gia_Man_t * p, Vec_Int_t * vInit );
|
||||
int c, fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
if ( pAbc->pGia == NULL ) {
|
||||
Abc_Print( -1, "Abc_CommandAbc9Init1(): There is no AIG.\n" );
|
||||
return 0;
|
||||
}
|
||||
if ( Gia_ManRegNum(pAbc->pGia) == 0 ) {
|
||||
Abc_Print( -1, "Abc_CommandAbc9Init1(): There is no flops.\n" );
|
||||
return 0;
|
||||
}
|
||||
if ( pAbc->pGia->vRegInits == NULL ) {
|
||||
Abc_Print( -1, "Abc_CommandAbc9Init1(): Flop init states are not available.\n" );
|
||||
return 0;
|
||||
}
|
||||
Gia_ManFlipInit1( pAbc->pGia, pAbc->pGia->vRegInits );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &init1 [-vh]\n" );
|
||||
Abc_Print( -2, "\t complements the inputs/outputs of flops with const-1 initial state\n" );
|
||||
Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
|
|||
Loading…
Reference in New Issue