ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
simSymSim.c
Go to the documentation of this file.
1
20
21#include "base/abc/abc.h"
22#include "sim.h"
23
25
26
30
31static void Sim_SymmsCreateSquare( Sym_Man_t * p, unsigned * pPat );
32static void Sim_SymmsDeriveInfo( Sym_Man_t * p, unsigned * pPat, Abc_Obj_t * pNode, Vec_Ptr_t * vMatrsNonSym, int Output );
33
37
49void Sim_SymmsSimulate( Sym_Man_t * p, unsigned * pPat, Vec_Ptr_t * vMatrsNonSym )
50{
51 Abc_Obj_t * pNode;
52 int i, nPairsTotal, nPairsSym, nPairsNonSym;
53 abctime clk;
54
55 // create the simulation matrix
56 Sim_SymmsCreateSquare( p, pPat );
57 // simulate each node in the DFS order
58clk = Abc_Clock();
59 Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodes, pNode, i )
60 {
61// if ( Abc_NodeIsConst(pNode) )
62// continue;
63 Sim_UtilSimulateNodeOne( pNode, p->vSim, p->nSimWords, 0 );
64 }
65p->timeSim += Abc_Clock() - clk;
66 // collect info into the CO matrices
67clk = Abc_Clock();
68 Abc_NtkForEachCo( p->pNtk, pNode, i )
69 {
70 pNode = Abc_ObjFanin0(pNode);
71// if ( Abc_ObjIsCi(pNode) || Abc_AigNodeIsConst(pNode) )
72// continue;
73 nPairsTotal = Vec_IntEntry(p->vPairsTotal, i);
74 nPairsSym = Vec_IntEntry(p->vPairsSym, i);
75 nPairsNonSym = Vec_IntEntry(p->vPairsNonSym,i);
76 assert( nPairsTotal >= nPairsSym + nPairsNonSym );
77 if ( nPairsTotal == nPairsSym + nPairsNonSym )
78 continue;
79 Sim_SymmsDeriveInfo( p, pPat, pNode, vMatrsNonSym, i );
80 }
81p->timeMatr += Abc_Clock() - clk;
82}
83
95void Sim_SymmsCreateSquare( Sym_Man_t * p, unsigned * pPat )
96{
97 unsigned * pSimInfo;
98 Abc_Obj_t * pNode;
99 int i, w;
100 // for each PI var copy the pattern
101 Abc_NtkForEachCi( p->pNtk, pNode, i )
102 {
103 pSimInfo = (unsigned *)Vec_PtrEntry( p->vSim, pNode->Id );
104 if ( Sim_HasBit(pPat, i) )
105 {
106 for ( w = 0; w < p->nSimWords; w++ )
107 pSimInfo[w] = SIM_MASK_FULL;
108 }
109 else
110 {
111 for ( w = 0; w < p->nSimWords; w++ )
112 pSimInfo[w] = 0;
113 }
114 // flip one bit
115 Sim_XorBit( pSimInfo, i );
116 }
117}
118
130void Sim_SymmsDeriveInfo( Sym_Man_t * p, unsigned * pPat, Abc_Obj_t * pNode, Vec_Ptr_t * vMatrsNonSym, int Output )
131{
132 Extra_BitMat_t * pMat;
133 Vec_Int_t * vSupport;
134 unsigned * pSupport;
135 unsigned * pSimInfo;
136 int i, w, Index;
137 // get the matrix, the support, and the simulation info
138 pMat = (Extra_BitMat_t *)Vec_PtrEntry( vMatrsNonSym, Output );
139 vSupport = Vec_VecEntryInt( p->vSupports, Output );
140 pSupport = (unsigned *)Vec_PtrEntry( p->vSuppFun, Output );
141 pSimInfo = (unsigned *)Vec_PtrEntry( p->vSim, pNode->Id );
142 // generate vectors A1 and A2
143 for ( w = 0; w < p->nSimWords; w++ )
144 {
145 p->uPatCol[w] = pSupport[w] & pPat[w] & pSimInfo[w];
146 p->uPatRow[w] = pSupport[w] & pPat[w] & ~pSimInfo[w];
147 }
148 // add two dimensions
149 Vec_IntForEachEntry( vSupport, i, Index )
150 if ( Sim_HasBit( p->uPatCol, i ) )
151 Extra_BitMatrixOr( pMat, i, p->uPatRow );
152 // add two dimensions
153 Vec_IntForEachEntry( vSupport, i, Index )
154 if ( Sim_HasBit( p->uPatRow, i ) )
155 Extra_BitMatrixOr( pMat, i, p->uPatCol );
156 // generate vectors B1 and B2
157 for ( w = 0; w < p->nSimWords; w++ )
158 {
159 p->uPatCol[w] = pSupport[w] & ~pPat[w] & pSimInfo[w];
160 p->uPatRow[w] = pSupport[w] & ~pPat[w] & ~pSimInfo[w];
161 }
162 // add two dimensions
163 Vec_IntForEachEntry( vSupport, i, Index )
164 if ( Sim_HasBit( p->uPatCol, i ) )
165 Extra_BitMatrixOr( pMat, i, p->uPatRow );
166 // add two dimensions
167 Vec_IntForEachEntry( vSupport, i, Index )
168 if ( Sim_HasBit( p->uPatRow, i ) )
169 Extra_BitMatrixOr( pMat, i, p->uPatCol );
170}
171
175
176
178
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
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
struct Extra_BitMat_t_ Extra_BitMat_t
Definition extra.h:81
void Extra_BitMatrixOr(Extra_BitMat_t *p, int i, unsigned *pInfo)
void Sim_SymmsSimulate(Sym_Man_t *p, unsigned *pPat, Vec_Ptr_t *vMatrsNonSym)
FUNCTION DEFINITIONS ///.
Definition simSymSim.c:49
#define Sim_HasBit(p, i)
Definition sim.h:163
void Sim_UtilSimulateNodeOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords, int nOffset)
Definition simUtils.c:303
#define SIM_MASK_FULL
Definition sim.h:151
#define Sim_XorBit(p, i)
Definition sim.h:162
typedefABC_NAMESPACE_HEADER_START struct Sym_Man_t_ Sym_Man_t
INCLUDES ///.
Definition sim.h:48
int Id
Definition abc.h:132
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55