abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
simSymSim.c File Reference
#include "base/abc/abc.h"
#include "sim.h"

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START void 
Sim_SymmsCreateSquare (Sym_Man_t *p, unsigned *pPat)
 DECLARATIONS ///. More...
 
static void Sim_SymmsDeriveInfo (Sym_Man_t *p, unsigned *pPat, Abc_Obj_t *pNode, Vec_Ptr_t *vMatrsNonSym, int Output)
 
void Sim_SymmsSimulate (Sym_Man_t *p, unsigned *pPat, Vec_Ptr_t *vMatrsNonSym)
 FUNCTION DEFINITIONS ///. More...
 

Function Documentation

void Sim_SymmsCreateSquare ( Sym_Man_t p,
unsigned *  pPat 
)
static

DECLARATIONS ///.

CFile****************************************************************

FileName [simSymSim.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Simulation to determine two-variable symmetries.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
simSymSim.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

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

Synopsis [Creates the square matrix of simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 95 of file simSymSim.c.

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 }
#define SIM_MASK_FULL
Definition: sim.h:151
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Sim_HasBit(p, i)
Definition: sim.h:163
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
int Id
Definition: abc.h:132
#define Sim_XorBit(p, i)
Definition: sim.h:162
void Sim_SymmsDeriveInfo ( Sym_Man_t p,
unsigned *  pPat,
Abc_Obj_t pNode,
Vec_Ptr_t vMatrsNonSym,
int  Output 
)
static

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

Synopsis [Transfers the info to the POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file simSymSim.c.

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 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
for(p=first;p->value< newval;p=p->next)
#define Sim_HasBit(p, i)
Definition: sim.h:163
if(last==0)
Definition: sparse_int.h:34
static Vec_Int_t * Vec_VecEntryInt(Vec_Vec_t *p, int i)
Definition: vecVec.h:276
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Id
Definition: abc.h:132
void Extra_BitMatrixOr(Extra_BitMat_t *p, int i, unsigned *pInfo)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Sim_SymmsSimulate ( Sym_Man_t p,
unsigned *  pPat,
Vec_Ptr_t vMatrsNonSym 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Detects non-symmetric pairs using one pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file simSymSim.c.

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
58 clk = 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  }
65 p->timeSim += Abc_Clock() - clk;
66  // collect info into the CO matrices
67 clk = 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  }
81 p->timeMatr += Abc_Clock() - clk;
82 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static abctime Abc_Clock()
Definition: abc_global.h:279
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void Sim_UtilSimulateNodeOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords, int nOffset)
Definition: simUtils.c:302
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static ABC_NAMESPACE_IMPL_START void Sim_SymmsCreateSquare(Sym_Man_t *p, unsigned *pPat)
DECLARATIONS ///.
Definition: simSymSim.c:95
static void Sim_SymmsDeriveInfo(Sym_Man_t *p, unsigned *pPat, Abc_Obj_t *pNode, Vec_Ptr_t *vMatrsNonSym, int Output)
Definition: simSymSim.c:130
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278