ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
simSupp.c File Reference
#include "base/abc/abc.h"
#include "proof/fraig/fraig.h"
#include "sim.h"
Include dependency graph for simSupp.c:

Go to the source code of this file.

Functions

Vec_Ptr_tSim_ComputeStrSupp (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
Vec_Ptr_tSim_ComputeFunSupp (Abc_Ntk_t *pNtk, int fVerbose)
 
int Sim_NtkSimTwoPats_rec (Abc_Obj_t *pNode)
 

Function Documentation

◆ Sim_ComputeFunSupp()

Vec_Ptr_t * Sim_ComputeFunSupp ( Abc_Ntk_t * pNtk,
int fVerbose )

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

Synopsis [Compute functional supports.]

Description [Supports are returned as an array of bit strings, one for each CO.]

SideEffects []

SeeAlso []

Definition at line 103 of file simSupp.c.

104{
105 Sim_Man_t * p;
106 Vec_Ptr_t * vResult;
107 int nSolved, i;
108 abctime clk = Abc_Clock();
109
110 srand( 0xABC );
111
112 // start the simulation manager
113 p = Sim_ManStart( pNtk, 0 );
114
115 // compute functional support using one round of random simulation
116 Sim_UtilAssignRandom( p );
117 Sim_ComputeSuppRound( p, 0 );
118
119 // set the support targets
120 Sim_ComputeSuppSetTargets( p );
121 if ( fVerbose )
122 printf( "Number of support targets after simulation = %5d.\n", Vec_VecSizeSize(p->vSuppTargs) );
123 if ( Vec_VecSizeSize(p->vSuppTargs) == 0 )
124 goto exit;
125
126 for ( i = 0; i < 1; i++ )
127 {
128 // compute patterns using one round of random simulation
129 Sim_UtilAssignRandom( p );
130 nSolved = Sim_ComputeSuppRound( p, 1 );
131 if ( Vec_VecSizeSize(p->vSuppTargs) == 0 )
132 goto exit;
133
134 if ( fVerbose )
135 printf( "Targets = %5d. Solved = %5d. Fifo = %5d.\n",
136 Vec_VecSizeSize(p->vSuppTargs), nSolved, Vec_PtrSize(p->vFifo) );
137 }
138
139 // try to solve the support targets
140 while ( Vec_VecSizeSize(p->vSuppTargs) > 0 )
141 {
142 // solve targets until the first disproved one (which gives counter-example)
143 Sim_SolveTargetsUsingSat( p, p->nSimWords/p->nSuppWords );
144 // compute additional functional support
145 Sim_UtilAssignFromFifo( p );
146 nSolved = Sim_ComputeSuppRound( p, 1 );
147
148if ( fVerbose )
149 printf( "Targets = %5d. Solved = %5d. Fifo = %5d. SAT runs = %3d.\n",
150 Vec_VecSizeSize(p->vSuppTargs), nSolved, Vec_PtrSize(p->vFifo), p->nSatRuns );
151 }
152
153exit:
154p->timeTotal = Abc_Clock() - clk;
155 vResult = p->vSuppFun;
156 // p->vSuppFun = NULL;
157 Sim_ManStop( p );
158 return vResult;
159}
ABC_INT64_T abctime
Definition abc_global.h:332
Cube * p
Definition exorList.c:222
struct Sim_Man_t_ Sim_Man_t
Definition sim.h:100
Sim_Man_t * Sim_ManStart(Abc_Ntk_t *pNtk, int fLightweight)
Definition simMan.c:166
void Sim_ManStop(Sim_Man_t *p)
Definition simMan.c:208
VOID_HACK exit()
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:

◆ Sim_ComputeStrSupp()

Vec_Ptr_t * Sim_ComputeStrSupp ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes structural supports.]

Description [Supports are returned as an array of bit strings, one for each CO.]

SideEffects []

SeeAlso []

Definition at line 57 of file simSupp.c.

58{
59 Vec_Ptr_t * vSuppStr;
60 Abc_Obj_t * pNode;
61 unsigned * pSimmNode, * pSimmNode1, * pSimmNode2;
62 int nSuppWords, i, k;
63 // allocate room for structural supports
64 nSuppWords = SIM_NUM_WORDS( Abc_NtkCiNum(pNtk) );
65 vSuppStr = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), nSuppWords, 1 );
66 // assign the structural support to the PIs
67 Abc_NtkForEachCi( pNtk, pNode, i )
68 Sim_SuppStrSetVar( vSuppStr, pNode, i );
69 // derive the structural supports of the internal nodes
70 Abc_NtkForEachNode( pNtk, pNode, i )
71 {
72// if ( Abc_NodeIsConst(pNode) )
73// continue;
74 pSimmNode = (unsigned *)vSuppStr->pArray[ pNode->Id ];
75 pSimmNode1 = (unsigned *)vSuppStr->pArray[ Abc_ObjFaninId0(pNode) ];
76 pSimmNode2 = (unsigned *)vSuppStr->pArray[ Abc_ObjFaninId1(pNode) ];
77 for ( k = 0; k < nSuppWords; k++ )
78 pSimmNode[k] = pSimmNode1[k] | pSimmNode2[k];
79 }
80 // set the structural supports of the PO nodes
81 Abc_NtkForEachCo( pNtk, pNode, i )
82 {
83 pSimmNode = (unsigned *)vSuppStr->pArray[ pNode->Id ];
84 pSimmNode1 = (unsigned *)vSuppStr->pArray[ Abc_ObjFaninId0(pNode) ];
85 for ( k = 0; k < nSuppWords; k++ )
86 pSimmNode[k] = pSimmNode1[k];
87 }
88 return vSuppStr;
89}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
Vec_Ptr_t * Sim_UtilInfoAlloc(int nSize, int nWords, int fClean)
FUNCTION DEFINITIONS ///.
Definition simUtils.c:57
#define SIM_NUM_WORDS(n)
MACRO DEFINITIONS ///.
Definition sim.h:148
#define Sim_SuppStrSetVar(vSupps, pNode, v)
Definition sim.h:166
int Id
Definition abc.h:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sim_NtkSimTwoPats_rec()

int Sim_NtkSimTwoPats_rec ( Abc_Obj_t * pNode)

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

Synopsis [Saves the counter example.]

Description []

SideEffects []

SeeAlso []

Definition at line 548 of file simSupp.c.

549{
550 int Value0, Value1;
551 if ( Abc_NodeIsTravIdCurrent( pNode ) )
552 return (int)(ABC_PTRUINT_T)pNode->pCopy;
553 Abc_NodeSetTravIdCurrent( pNode );
554 Value0 = Sim_NtkSimTwoPats_rec( Abc_ObjFanin0(pNode) );
555 Value1 = Sim_NtkSimTwoPats_rec( Abc_ObjFanin1(pNode) );
556 if ( Abc_ObjFaninC0(pNode) )
557 Value0 = ~Value0;
558 if ( Abc_ObjFaninC1(pNode) )
559 Value1 = ~Value1;
560 pNode->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)(Value0 & Value1);
561 return Value0 & Value1;
562}
int Sim_NtkSimTwoPats_rec(Abc_Obj_t *pNode)
Definition simSupp.c:548
Abc_Obj_t * pCopy
Definition abc.h:148
Here is the call graph for this function:
Here is the caller graph for this function: