Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/base/abc/abc.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ struct Abc_Ntk_t_
Vec_Ptr_t * vPios; // the array of PIOs
Vec_Ptr_t * vBoxes; // the array of boxes
Vec_Ptr_t * vLtlProperties;
// test pattern list information
Vec_Ptr_t * vTestPatterns; // the array of test patterns (each pattern is Vec_Int_t*)
// fault list information
Abc_Fault_t * pFaultList; // the list of faults
int nFaults; // total number of faults
Expand Down Expand Up @@ -1119,8 +1121,12 @@ extern ABC_DLL void Abc_NtkInsertFaultSimGates(Abc_Ntk_t * pNtk);
extern ABC_DLL void Abc_NtkGenerateCollapsedCheckpointFaultList( Abc_Ntk_t * pNtk );
extern ABC_DLL void Abc_NtkCreateFaultConstraintNetwork(Abc_Ntk_t * pNtk);



// Test pattern management functions
extern ABC_DLL void Abc_NtkInitTestPatterns( Abc_Ntk_t * pNtk );
extern ABC_DLL void Abc_NtkAddTestPattern( Abc_Ntk_t * pNtk, Vec_Int_t * vPattern );
extern ABC_DLL void Abc_NtkFreeTestPatterns( Abc_Ntk_t * pNtk );
extern ABC_DLL int Abc_NtkTestPatternNum( Abc_Ntk_t * pNtk );
extern ABC_DLL Vec_Int_t * Abc_NtkGetTestPattern( Abc_Ntk_t * pNtk, int i );

ABC_NAMESPACE_HEADER_END

Expand Down
101 changes: 101 additions & 0 deletions src/base/abc/abcFault.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,4 +1110,105 @@ void Abc_NtkCreateFaultConstraintNetwork(Abc_Ntk_t * pNtk)
printf("[FaultConstraint] Completed fault constraint network creation\n");
}

/**Function*************************************************************

Synopsis [Initializes the test pattern list.]

Description []

SideEffects []

SeeAlso []

***********************************************************************/
void Abc_NtkInitTestPatterns( Abc_Ntk_t * pNtk )
{
if ( pNtk->vTestPatterns )
Abc_NtkFreeTestPatterns( pNtk );
pNtk->vTestPatterns = Vec_PtrAlloc( 100 ); // Initial capacity of 100 patterns
}

/**Function*************************************************************

Synopsis [Adds a test pattern to the network.]

Description [The pattern should be a Vec_Int_t* containing 0s and 1s
with size equal to the number of primary inputs.]

SideEffects []

SeeAlso []

***********************************************************************/
void Abc_NtkAddTestPattern( Abc_Ntk_t * pNtk, Vec_Int_t * vPattern )
{
Vec_Int_t * vPatternCopy;
// Check if test pattern list is initialized
if ( !pNtk->vTestPatterns )
Abc_NtkInitTestPatterns( pNtk );
// Create a copy of the pattern
vPatternCopy = Vec_IntDup( vPattern );
// Add the pattern to the list
Vec_PtrPush( pNtk->vTestPatterns, vPatternCopy );
}

/**Function*************************************************************

Synopsis [Frees the test pattern list.]

Description []

SideEffects []

SeeAlso []

***********************************************************************/
void Abc_NtkFreeTestPatterns( Abc_Ntk_t * pNtk )
{
Vec_Int_t * vPattern;
int i;
if ( !pNtk->vTestPatterns )
return;
// Free each pattern
Vec_PtrForEachEntry( Vec_Int_t *, pNtk->vTestPatterns, vPattern, i )
Vec_IntFree( vPattern );
// Free the list itself
Vec_PtrFree( pNtk->vTestPatterns );
pNtk->vTestPatterns = NULL;
}

/**Function*************************************************************

Synopsis [Returns the number of test patterns.]

Description []

SideEffects []

SeeAlso []

***********************************************************************/
int Abc_NtkTestPatternNum( Abc_Ntk_t * pNtk )
{
return pNtk->vTestPatterns ? Vec_PtrSize(pNtk->vTestPatterns) : 0;
}

/**Function*************************************************************

Synopsis [Gets a specific test pattern by index.]

Description []

SideEffects []

SeeAlso []

***********************************************************************/
Vec_Int_t * Abc_NtkGetTestPattern( Abc_Ntk_t * pNtk, int i )
{
assert( pNtk->vTestPatterns );
assert( i >= 0 && i < Vec_PtrSize(pNtk->vTestPatterns) );
return (Vec_Int_t *)Vec_PtrEntry( pNtk->vTestPatterns, i );
}

ABC_NAMESPACE_IMPL_END