abc/src/base/cba/cbaReadVer.c
// looks at multi-bit signal; if one bit is repeated, returns this bit; otherwise, returns -1
looks at multi-bit signal; if one bit is repeated, returns this bit; otherwise, returns -1
looks at multi - bit signal ; if one bit is repeated returns this bit ; otherwise returns - 1
int Prs_CreateBitSignal( Prs_Ntk_t * pNtk, int Sig )
{
    Vec_Int_t * vSigs;
    int i, SigTemp, SigOne = -1, Value = Abc_Lit2Var2( Sig );
    Prs_ManType_t Type = (Prs_ManType_t)Abc_Lit2Att2( Sig );
    if ( Type == CBA_PRS_NAME || Type == CBA_PRS_SLICE )
        return -1;
    if ( Type == CBA_PRS_CONST )
    {
        int fOnly0 = 1, fOnly1 = 1;
        char * pConst = Prs_NtkConst(pNtk, Value);
        pConst = strchr( pConst, '\'' ) + 1;
        assert( *pConst == 'b' );
        while ( *++pConst )
            if ( *pConst == '0' )
                fOnly1 = 0;
            else if ( *pConst == '1' )
                fOnly0 = 0;
        if ( fOnly0 )
            return Abc_Var2Lit2( 1, CBA_PRS_CONST ); 
        if ( fOnly1 )
            return Abc_Var2Lit2( 2, CBA_PRS_CONST ); 
        return -1;
    }
    assert( Type == CBA_PRS_CONCAT );
    vSigs = Prs_CatSignals( pNtk, Value );
    Vec_IntForEachEntry( vSigs, SigTemp, i )
    {
        Value = Abc_Lit2Var2( SigTemp );
        Type = (Prs_ManType_t)Abc_Lit2Att2( SigTemp );
        if ( Type != CBA_PRS_NAME )
            return -1;
        if ( SigOne == -1 )
            SigOne = Value;
        else if ( SigOne != Value )
            return -1;
    }
    assert( SigOne >= 0 );
    return Abc_Var2Lit2( SigOne, CBA_PRS_NAME );
}
int Prs_CreateBitSignal ( Prs_Ntk_t * pNtk , int Sig ) { Vec_Int_t * vSigs ; int i , SigTemp , SigOne = -1 , Value = Abc_Lit2Var2 ( Sig ) ; Prs_ManType_t Type = ( Prs_ManType_t ) Abc_Lit2Att2 ( Sig ) ; if ( Type == CBA_PRS_NAME || Type == CBA_PRS_SLICE ) return -1 ; if ( Type == CBA_PRS_CONST ) { int fOnly0 = 1 , fOnly1 = 1 ; char * pConst = Prs_NtkConst ( pNtk , Value ) ; pConst = strchr ( pConst , ' \' ' ) + 1 ; assert ( * pConst == ' ' ) ; while ( * ++ pConst ) if ( * pConst == ' ' ) fOnly1 = 0 ; else if ( * pConst == ' ' ) fOnly0 = 0 ; if ( fOnly0 ) return Abc_Var2Lit2 ( 1 , CBA_PRS_CONST ) ; if ( fOnly1 ) return Abc_Var2Lit2 ( 2 , CBA_PRS_CONST ) ; return -1 ; } assert ( Type == CBA_PRS_CONCAT ) ; vSigs = Prs_CatSignals ( pNtk , Value ) ; Vec_IntForEachEntry ( vSigs , SigTemp , i ) { Value = Abc_Lit2Var2 ( SigTemp ) ; Type = ( Prs_ManType_t ) Abc_Lit2Att2 ( SigTemp ) ; if ( Type != CBA_PRS_NAME ) return -1 ; if ( SigOne == -1 ) SigOne = Value ; else if ( SigOne != Value ) return -1 ; } assert ( SigOne >= 0 ) ; return Abc_Var2Lit2 ( SigOne , CBA_PRS_NAME ) ; }
looks at multi-bit signal; if one bit is repeated, returns this bit; otherwise, returns -1
looks at multi - bit signal ; if one bit is repeated returns this bit ; otherwise returns - 1
// const0 // const1