ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaScript.c
Go to the documentation of this file.
1
20
21#include "giaAig.h"
22#include "base/main/main.h"
23#include "base/cmd/cmd.h"
24#include "proof/dch/dch.h"
25#include "opt/dau/dau.h"
26
28
29
33
37
50{
51 Gia_Obj_t * pObj;
52 int i;
53 Gia_ManForEachPi( p, pObj, i )
54 printf( "%d ", Gia_ObjLevel(p, pObj) );
55 printf( "\n" );
56}
57
69Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * pInit, int fOldAlgo, int fCoarsen, int fCutMin, int nRelaxRatio, int fDelayMin, int fVerbose, int fVeryVerbose )
70{
71 Gia_Man_t * p, * pNew, * pTemp;
72 Jf_Par_t Pars, * pPars = &Pars;
73 if ( fOldAlgo )
74 {
75 Jf_ManSetDefaultPars( pPars );
76 pPars->fCutMin = fCutMin;
77 }
78 else
79 {
80 Lf_ManSetDefaultPars( pPars );
81 pPars->fCutMin = fCutMin;
82 pPars->fCoarsen = fCoarsen;
83 pPars->nRelaxRatio = nRelaxRatio;
84 pPars->nAreaTuner = 1;
85 pPars->nCutNum = 4;
86 }
87 if ( fVerbose ) Gia_ManPrintStats( pInit, NULL );
88 p = Gia_ManDup( pInit );
89 Gia_ManTransferTiming( p, pInit );
90 if ( Gia_ManAndNum(p) == 0 )
91 {
92 pNew = Gia_ManDup(p);
93 Gia_ManTransferTiming( pNew, p );
94 Gia_ManStop( p );
95 return pNew;
96 }
97 // delay optimization
98 if ( fDelayMin && p->pManTime == NULL )
99 {
100 int Area0, Area1, Delay0, Delay1;
101 int fCutMin = pPars->fCutMin;
102 int fCoarsen = pPars->fCoarsen;
103 int nRelaxRatio = pPars->nRelaxRatio;
104 pPars->fCutMin = 0;
105 pPars->fCoarsen = 0;
106 pPars->nRelaxRatio = 0;
107 // perform mapping
108 if ( fOldAlgo )
109 Jf_ManPerformMapping( p, pPars );
110 else
111 Lf_ManPerformMapping( p, pPars );
112 Area0 = (int)pPars->Area;
113 Delay0 = (int)pPars->Delay;
114 // perform balancing
115 pNew = Gia_ManPerformDsdBalance( p, 6, 4, 0, 0 );
116 // perform mapping again
117 if ( fOldAlgo )
118 Jf_ManPerformMapping( pNew, pPars );
119 else
120 Lf_ManPerformMapping( pNew, pPars );
121 Area1 = (int)pPars->Area;
122 Delay1 = (int)pPars->Delay;
123 // choose the best result
124 if ( Delay1 < Delay0 - 1 || (Delay1 == Delay0 + 1 && 100.0 * (Area1 - Area0) / Area1 < 3.0) )
125 {
126 Gia_ManStop( p );
127 p = pNew;
128 }
129 else
130 {
131 Gia_ManStop( pNew );
132 Vec_IntFreeP( &p->vMapping );
133 }
134 // reset params
135 pPars->fCutMin = fCutMin;
136 pPars->fCoarsen = fCoarsen;
137 pPars->nRelaxRatio = nRelaxRatio;
138 }
139 // perform balancing
140 pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
141 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
142 Gia_ManStop( p );
143 // perform mapping
144 if ( fOldAlgo )
145 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
146 else
147 pNew = Lf_ManPerformMapping( pTemp = pNew, pPars );
148 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
149 if ( pTemp != pNew )
150 Gia_ManStop( pTemp );
151 // perform balancing
152 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
153 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
154 Gia_ManStop( pTemp );
155 return pNew;
156}
157Gia_Man_t * Gia_ManAigSyn3( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
158{
159 Gia_Man_t * pNew, * pTemp;
160 Jf_Par_t Pars, * pPars = &Pars;
161 Jf_ManSetDefaultPars( pPars );
162 pPars->nRelaxRatio = 40;
163 if ( fVerbose ) Gia_ManPrintStats( p, NULL );
164 if ( Gia_ManAndNum(p) == 0 )
165 {
166 pNew = Gia_ManDup(p);
167 Gia_ManTransferTiming( pNew, p );
168 //Gia_ManStop( p );
169 return pNew;
170 }
171 // perform balancing
172 pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
173 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
174 // perform mapping
175 pPars->nLutSize = 6;
176 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
177 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
178// Gia_ManStop( pTemp );
179 // perform balancing
180 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
181 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
182 Gia_ManStop( pTemp );
183 // perform mapping
184 pPars->nLutSize = 4;
185 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
186 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
187// Gia_ManStop( pTemp );
188 // perform balancing
189 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
190 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
191 Gia_ManStop( pTemp );
192 return pNew;
193}
194Gia_Man_t * Gia_ManAigSyn4( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
195{
196 Gia_Man_t * pNew, * pTemp;
197 Jf_Par_t Pars, * pPars = &Pars;
198 Jf_ManSetDefaultPars( pPars );
199 pPars->nRelaxRatio = 40;
200 if ( fVerbose ) Gia_ManPrintStats( p, NULL );
201 if ( Gia_ManAndNum(p) == 0 )
202 {
203 pNew = Gia_ManDup(p);
204 Gia_ManTransferTiming( pNew, p );
205 //Gia_ManStop( p );
206 return pNew;
207 }
208//Gia_ManAigPrintPiLevels( p );
209 // perform balancing
210 pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
211 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
212 // perform mapping
213 pPars->nLutSize = 7;
214 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
215 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
216// Gia_ManStop( pTemp );
217 // perform extraction
218 pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
219 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
220 Gia_ManStop( pTemp );
221 // perform balancing
222 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
223 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
224 Gia_ManStop( pTemp );
225 // perform mapping
226 pPars->nLutSize = 5;
227 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
228 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
229// Gia_ManStop( pTemp );
230 // perform extraction
231 pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
232 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
233 Gia_ManStop( pTemp );
234 // perform balancing
235 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
236 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
237 Gia_ManStop( pTemp );
238//Gia_ManAigPrintPiLevels( pNew );
239 return pNew;
240}
241
254{
255 Vec_Ptr_t * vPios;
256 Gia_Obj_t * pObj;
257 int i;
258 assert( Aig_ManCiNum(p) == Gia_ManCiNum(pOrder) );
259 assert( Aig_ManCoNum(p) == Gia_ManCoNum(pOrder) );
260 vPios = Vec_PtrAlloc( Aig_ManCiNum(p) + Aig_ManCoNum(p) );
261 Gia_ManForEachObj( pOrder, pObj, i )
262 {
263 if ( Gia_ObjIsCi(pObj) )
264 Vec_PtrPush( vPios, Aig_ManCi(p, Gia_ObjCioId(pObj)) );
265 else if ( Gia_ObjIsCo(pObj) )
266 Vec_PtrPush( vPios, Aig_ManCo(p, Gia_ObjCioId(pObj)) );
267 }
268 return vPios;
269}
270
283{
284 Vec_Int_t * vBufObjs;
285 Gia_Man_t * pNew;
286 Gia_Obj_t * pObj;
287 int i, k = 0;
288 assert( Gia_ManBufNum(p) > 0 );
289 assert( Gia_ManRegNum(p) == 0 );
290 assert( !Gia_ManHasChoices(p) );
291 pNew = Gia_ManStart( Gia_ManObjNum(p) );
292 pNew->pName = Abc_UtilStrsav( p->pName );
293 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
295 Gia_ManConst0(p)->Value = 0;
296 Gia_ManForEachCi( p, pObj, i )
297 pObj->Value = Gia_ManAppendCi( pNew );
298 vBufObjs = Vec_IntAlloc( Gia_ManBufNum(p) );
299 for ( i = 0; i < Gia_ManBufNum(p); i++ )
300 Vec_IntPush( vBufObjs, Gia_ManAppendCi(pNew) );
301 Gia_ManForEachAnd( p, pObj, i )
302 {
303 if ( Gia_ObjIsBuf(pObj) )
304 {
305 pObj->Value = Vec_IntEntry( vBufObjs, k );
306 Vec_IntWriteEntry( vBufObjs, k++, Gia_ObjFanin0Copy(pObj) );
307 }
308 else
309 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
310 }
311 assert( k == Gia_ManBufNum(p) );
312 for ( i = 0; i < Gia_ManBufNum(p); i++ )
313 Gia_ManAppendCo( pNew, Vec_IntEntry(vBufObjs, i) );
314 Vec_IntFree( vBufObjs );
315 Gia_ManForEachCo( p, pObj, i )
316 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
317 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
318 return pNew;
319}
321{
322 Gia_Man_t * pNew;
323 Gia_Obj_t * pObj;
324 int nPiReal = Gia_ManCiNum(p) - nBarBufs;
325 int nPoReal = Gia_ManCoNum(p) - nBarBufs;
326 int i, k = 0;
327 assert( Gia_ManBufNum(p) == 0 );
328 assert( Gia_ManRegNum(p) == 0 );
329 assert( Gia_ManHasChoices(p) );
330 pNew = Gia_ManStart( Gia_ManObjNum(p) );
331 pNew->pName = Abc_UtilStrsav( p->pName );
332 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
333 if ( Gia_ManHasChoices(p) )
334 pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
336 Gia_ManConst0(p)->Value = 0;
337 for ( i = 0; i < nPiReal; i++ )
338 Gia_ManCi(p, i)->Value = Gia_ManAppendCi( pNew );
339 Gia_ManForEachAnd( p, pObj, i )
340 {
341 for ( ; k < nBarBufs; k++ )
342 if ( ~Gia_ObjFanin0(Gia_ManCo(p, k))->Value )
343 Gia_ManCi(p, nPiReal + k)->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(Gia_ManCo(p, k)) );
344 else
345 break;
346 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
347 if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
348 pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value);
349 }
350 for ( ; k < nBarBufs; k++ )
351 if ( ~Gia_ObjFanin0Copy(Gia_ManCo(p, k)) )
352 Gia_ManCi(p, nPiReal + k)->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(Gia_ManCo(p, k)) );
353 assert( k == nBarBufs );
354 for ( i = 0; i < nPoReal; i++ )
355 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManCo(p, nBarBufs+i)) );
356 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
357 assert( Gia_ManBufNum(pNew) == nBarBufs );
358 assert( Gia_ManCiNum(pNew) == nPiReal );
359 assert( Gia_ManCoNum(pNew) == nPoReal );
360 return pNew;
361}
362
375{
376 Aig_Man_t * pMan, * pTemp;
377 Gia_Man_t * pGia, * pMiter;
378 // derive miter
379 Vec_Ptr_t * vPios, * vGias = Vec_PtrAlloc( 3 );
380 if ( pGia3 ) Vec_PtrPush( vGias, pGia3 );
381 if ( pGia2 ) Vec_PtrPush( vGias, pGia2 );
382 if ( pGia1 ) Vec_PtrPush( vGias, pGia1 );
383 pMiter = Gia_ManChoiceMiter( vGias );
384 Vec_PtrFree( vGias );
385 // transform into an AIG
386 pMan = Gia_ManToAigSkip( pMiter, 3 );
387 Gia_ManStop( pMiter );
388 // compute choices
389 pMan = Dch_ComputeChoices( pTemp = pMan, pPars );
390 Aig_ManStop( pTemp );
391 // reconstruct the network
392 vPios = Gia_ManOrderPios( pMan, pGia1 );
393 pMan = Aig_ManDupDfsGuided( pTemp = pMan, vPios );
394 Aig_ManStop( pTemp );
395 Vec_PtrFree( vPios );
396 // convert to GIA
397 pGia = Gia_ManFromAigChoices( pMan );
398 Aig_ManStop( pMan );
399 return pGia;
400}
401Gia_Man_t * Gia_ManAigSynch2( Gia_Man_t * pInit, void * pPars0, int nLutSize, int nRelaxRatio )
402{
403 extern Gia_Man_t * Gia_ManLutBalance( Gia_Man_t * p, int nLutSize, int fUseMuxes, int fRecursive, int fOptArea, int fVerbose );
404 Dch_Pars_t * pParsDch = (Dch_Pars_t *)pPars0;
405 Gia_Man_t * pGia1, * pGia2, * pGia3, * pNew, * pTemp;
406 int fVerbose = pParsDch->fVerbose;
407 Jf_Par_t Pars, * pPars = &Pars;
408 Lf_ManSetDefaultPars( pPars );
409 pPars->fCutMin = 1;
410 pPars->fCoarsen = 1;
411 pPars->nRelaxRatio = nRelaxRatio;
412 pPars->nAreaTuner = 5;
413 pPars->nCutNum = 12;
414 pPars->fVerbose = fVerbose;
415 if ( fVerbose ) Gia_ManPrintStats( pInit, NULL );
416 pGia1 = Gia_ManDup( pInit );
417 if ( Gia_ManAndNum(pGia1) == 0 )
418 {
419 Gia_ManTransferTiming( pGia1, pInit );
420 return pGia1;
421 }
422 if ( pGia1->pManTime && pGia1->vLevels == NULL )
423 Gia_ManLevelWithBoxes( pGia1 );
424 // unmap if mapped
425 if ( Gia_ManHasMapping(pInit) )
426 {
427 Gia_ManTransferMapping( pGia1, pInit );
428 pGia1 = (Gia_Man_t *)Dsm_ManDeriveGia( pTemp = pGia1, 0 );
429 Gia_ManStop( pTemp );
430 }
431 // perform balancing
432 if ( Gia_ManBufNum(pGia1) || 1 )
433 pGia2 = Gia_ManAreaBalance( pGia1, 0, ABC_INFINITY, 0, 0 );
434 else
435 {
436 pGia2 = Gia_ManLutBalance( pGia1, nLutSize, 1, 1, 1, 0 );
437 pGia2 = Gia_ManAreaBalance( pTemp = pGia2, 0, ABC_INFINITY, 0, 0 );
438 Gia_ManStop( pTemp );
439 }
440 if ( fVerbose ) Gia_ManPrintStats( pGia2, NULL );
441 // perform mapping
442 pGia2 = Lf_ManPerformMapping( pTemp = pGia2, pPars );
443 if ( fVerbose ) Gia_ManPrintStats( pGia2, NULL );
444 if ( pTemp != pGia2 )
445 Gia_ManStop( pTemp );
446 // perform balancing
447 if ( pParsDch->fLightSynth || Gia_ManBufNum(pGia2) )
448 pGia3 = Gia_ManAreaBalance( pGia2, 0, ABC_INFINITY, 0, 0 );
449 else
450 {
451 assert( Gia_ManBufNum(pGia2) == 0 );
452 pGia2 = Gia_ManAreaBalance( pTemp = pGia2, 0, ABC_INFINITY, 0, 0 );
453 if ( fVerbose ) Gia_ManPrintStats( pGia2, NULL );
454 Gia_ManStop( pTemp );
455 // perform DSD balancing
456 pGia3 = Gia_ManPerformDsdBalance( pGia2, 6, 8, 0, 0 );
457 }
458 if ( fVerbose ) Gia_ManPrintStats( pGia3, NULL );
459 // perform choice computation
460 if ( Gia_ManBufNum(pInit) )
461 {
462 assert( Gia_ManBufNum(pInit) == Gia_ManBufNum(pGia1) );
463 pGia1 = Gia_ManDupFromBarBufs( pTemp = pGia1 );
464 Gia_ManStop( pTemp );
465 assert( Gia_ManBufNum(pInit) == Gia_ManBufNum(pGia2) );
466 pGia2 = Gia_ManDupFromBarBufs( pTemp = pGia2 );
467 Gia_ManStop( pTemp );
468 assert( Gia_ManBufNum(pInit) == Gia_ManBufNum(pGia3) );
469 pGia3 = Gia_ManDupFromBarBufs( pTemp = pGia3 );
470 Gia_ManStop( pTemp );
471 }
472 pNew = Gia_ManAigSynch2Choices( pGia1, pGia2, pGia3, pParsDch );
473 Gia_ManStop( pGia1 );
474 Gia_ManStop( pGia2 );
475 Gia_ManStop( pGia3 );
476 if ( Gia_ManBufNum(pInit) )
477 {
478 pNew = Gia_ManDupToBarBufs( pTemp = pNew, Gia_ManBufNum(pInit) );
479 Gia_ManStop( pTemp );
480 }
481 // copy names
482 ABC_FREE( pNew->pName );
483 ABC_FREE( pNew->pSpec );
484 pNew->pName = Abc_UtilStrsav(pInit->pName);
485 pNew->pSpec = Abc_UtilStrsav(pInit->pSpec);
486 Gia_ManTransferTiming( pNew, pInit );
487 return pNew;
488}
489
501void Gia_ManPerformMap( int nAnds, int nLutSize, int nCutNum, int fMinAve, int fUseMfs, int fVerbose )
502{
503 char Command[200];
504 sprintf( Command, "&unmap; &lf -K %d -C %d -k %s; &save", nLutSize, nCutNum, fMinAve?"-t":"" );
505// sprintf( Command, "&unmap; &if -K %d -C %d %s; &save", nLutSize, nCutNum, fMinAve?"-t":"" );
507 if ( fVerbose )
508 {
509 printf( "MAPPING:\n" );
510 printf( "Mapping with &lf -k:\n" );
512 }
513 sprintf( Command, "&unmap; &lf -K %d -C %d %s; &save", nLutSize, nCutNum, fMinAve?"-t":"" );
515 if ( fVerbose )
516 {
517 printf( "Mapping with &lf:\n" );
519 }
520 if ( (nLutSize == 4 && nAnds < 100000) || (nLutSize == 6 && nAnds < 2000) )
521 {
522 sprintf( Command, "&unmap; &if -sz -S %d%d -K %d -C %d %s", nLutSize, nLutSize, 2*nLutSize-1, 2*nCutNum, fMinAve?"-t":"" );
524 Vec_IntFreeP( &Abc_FrameReadGia(Abc_FrameGetGlobalFrame())->vPacking );
526 if ( fVerbose )
527 {
528 printf( "Mapping with &if -sz -S %d%d -K %d -C %d %s:\n", nLutSize, nLutSize, 2*nLutSize-1, 2*nCutNum, fMinAve?"-t":"" );
530 }
531 }
533 if ( fUseMfs )
534 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "&put; mfs2 -W 4 -M 500 -C 7000; &get -m" );
535 if ( fVerbose )
536 {
537 printf( "Mapping final:\n" );
539 }
540}
541void Gia_ManPerformRound( int fIsMapped, int nAnds, int nLevels, int nLutSize, int nCutNum, int fMinAve, int fUseMfs, int fVerbose )
542{
543 char Command[200];
544
545 // perform AIG-based synthesis
546 if ( nAnds < 50000 )
547 {
549 sprintf( Command, "&dsdb; &dch -C 500; &if -K %d -C %d %s; &save", nLutSize, nCutNum, fMinAve?"-t":"" );
551 if ( fVerbose )
552 {
553 printf( "Mapping with &dch -C 500; &if -K %d -C %d %s:\n", nLutSize, nCutNum, fMinAve?"-t":"" );
555 }
557 }
558
559 // perform AIG-based synthesis
560 if ( nAnds < 20000 )
561 {
563 sprintf( Command, "&dsdb; &dch -C 500; &if -K %d -C %d %s; &save", nLutSize, nCutNum, fMinAve?"-t":"" );
565 if ( fVerbose )
566 {
567 printf( "Mapping with &dch -C 500; &if -K %d -C %d %s:\n", nLutSize, nCutNum, fMinAve?"-t":"" );
569 }
571 }
572
573 // perform first round of mapping
574 Gia_ManPerformMap( nAnds, nLutSize, nCutNum, fMinAve, fUseMfs, fVerbose );
576
577 // perform synthesis
579
580 // perform second round of mapping
581 Gia_ManPerformMap( nAnds, nLutSize, nCutNum, fMinAve, fUseMfs, fVerbose );
583
584 // perform synthesis
585 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "&syn2 -m -R 10; &dsdb" );
586
587 // prepare for final mapping
588 sprintf( Command, "&blut -a -K %d", nLutSize );
590
591 // perform third round of mapping
592 Gia_ManPerformMap( nAnds, nLutSize, nCutNum, fMinAve, fUseMfs, fVerbose );
593}
594void Gia_ManPerformFlow( int fIsMapped, int nAnds, int nLevels, int nLutSize, int nCutNum, int fMinAve, int fUseMfs, int fVerbose )
595{
596 // remove comb equivs
597 if ( fIsMapped )
599// if ( Abc_FrameReadGia(Abc_FrameGetGlobalFrame())->pManTime )
600// Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "&sweep" );
601// else
602// Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "&fraig -c" );
603
604 // perform first round
605 Gia_ManPerformRound( fIsMapped, nAnds, nLevels, nLutSize, nCutNum, fMinAve, fUseMfs, fVerbose );
606
607 // perform synthesis
609
610 // perform first round
611 Gia_ManPerformRound( fIsMapped, nAnds, nLevels, nLutSize, nCutNum, fMinAve, fUseMfs, fVerbose );
612}
613
625void Gia_ManPerformFlow2( int fIsMapped, int nAnds, int nLevels, int nLutSize, int nCutNum, int fBalance, int fMinAve, int fUseMfs, int fVerbose )
626{
627 char Comm1[1000], Comm2[1000], Comm3[1000], Comm4[1000];
628 if ( nLutSize == 0 )
629 {
630 sprintf( Comm1, "&synch2 -K 6 -C 500; &if -m%s -C %d; %s &save", fMinAve?"t":"", nCutNum, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
631 sprintf( Comm2, "&dch -C 500; &if -m%s -C %d; %s &save", fMinAve?"t":"", nCutNum+4, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
632 sprintf( Comm3, "&synch2 -K 6 -C 500; &lf -m%s -E 5 -C %d; %s &save", fMinAve?"t":"", nCutNum, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
633 sprintf( Comm4, "&dch -C 500; &lf -m%sk -E 5 -C %d; %s &save", fMinAve?"t":"", nCutNum+4, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
634 }
635 else
636 {
637 sprintf( Comm1, "&synch2 -K %d -C 500; &if -m%s -K %d -C %d; %s &save", nLutSize, fMinAve?"t":"", nLutSize, nCutNum, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
638 sprintf( Comm2, "&dch -C 500; &if -m%s -K %d -C %d; %s &save", fMinAve?"t":"", nLutSize, nCutNum+4, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
639 sprintf( Comm3, "&synch2 -K %d -C 500; &lf -m%s -E 5 -K %d -C %d; %s &save", nLutSize, fMinAve?"t":"", nLutSize, nCutNum, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
640 sprintf( Comm4, "&dch -C 500; &lf -m%sk -E 5 -K %d -C %d; %s &save", fMinAve?"t":"", nLutSize, nCutNum+4, fUseMfs ? "&put; mfs2 -W 4 -M 500 -C 7000; &get -m;":"" );
641 }
642
643 // perform synthesis
644 if ( fVerbose )
645 printf( "Trying synthesis...\n" );
646 if ( fIsMapped )
649 if ( fVerbose )
651
652 // perform synthesis
655 if ( fVerbose )
657
658 // return the result
660 if ( fVerbose )
662
663
664 // perform balancing
665 if ( fBalance )
666 {
667 if ( fVerbose )
668 printf( "Trying SOP balancing...\n" );
669 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "&st; &sopb -R 10 -C 4" );
670 }
671
672
673 // perform synthesis
675 if ( fVerbose )
677
678 // perform synthesis
681 if ( fVerbose )
683
684 // return the result
686 if ( fVerbose )
688 if ( nAnds > 100000 )
689 return;
690
691
692 // perform balancing
693 if ( fBalance )
694 {
695 if ( fVerbose )
696 printf( "Trying SOP balancing...\n" );
697 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "&st; &sopb -R 10" );
698 }
699
700
701 // perform synthesis
703 if ( fVerbose )
705
706 // perform synthesis
709 if ( fVerbose )
711
712 // return the result
714 if ( fVerbose )
716 if ( nAnds > 50000 )
717 return;
718
719
720 // perform balancing
721 if ( fBalance )
722 {
723 if ( fVerbose )
724 printf( "Trying SOP balancing...\n" );
725 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "&st; &sopb -R 10" );
726 }
727
728
729 // perform synthesis
731 if ( fVerbose )
733
734 // perform synthesis
737 if ( fVerbose )
739
740 // return the result
742 if ( fVerbose )
744}
745
746
758void Gia_ManPerformFlow3( int nLutSize, int nCutNum, int fBalance, int fMinAve, int fUseMfs, int fUseLutLib, int fVerbose )
759{
760 char Comm1[200], Comm2[200], Comm3[200];
761 if ( fUseLutLib )
762 sprintf( Comm1, "&st; &if -C %d; &save; &st; &syn2; &if -C %d; &save; &load", nCutNum, nCutNum );
763 else
764 sprintf( Comm1, "&st; &if -C %d -K %d; &save; &st; &syn2; &if -C %d -K %d; &save; &load", nCutNum, nLutSize, nCutNum, nLutSize );
765 if ( fUseLutLib )
766 sprintf( Comm2, "&st; &if -%s -K 6; &dch -f; &if -C %d; %s&save; &load", Abc_NtkRecIsRunning3() ? "y" : "g", nCutNum, fUseMfs ? "&mfs; ":"" );
767 else
768 sprintf( Comm2, "&st; &if -%s -K 6; &dch -f; &if -C %d -K %d; %s&save; &load", Abc_NtkRecIsRunning3() ? "y" : "g", nCutNum, nLutSize, fUseMfs ? "&mfs; ":"" );
769 if ( fUseLutLib )
770 sprintf( Comm3, "&st; &if -%s -K 6; &synch2; &if -C %d; %s&save; &load", Abc_NtkRecIsRunning3() ? "y" : "g", nCutNum, fUseMfs ? "&mfs; ":"" );
771 else
772 sprintf( Comm3, "&st; &if -%s -K 6; &synch2; &if -C %d -K %d; %s&save; &load", Abc_NtkRecIsRunning3() ? "y" : "g", nCutNum, nLutSize, fUseMfs ? "&mfs; ":"" );
773
774 if ( fVerbose ) printf( "Trying simple synthesis with %s...\n", Abc_NtkRecIsRunning3() ? "LMS" : "SOP balancing" );
776 if ( fVerbose )
778
779 if ( Gia_ManAndNum( Abc_FrameReadGia(Abc_FrameGetGlobalFrame()) ) < 200000 )
780 {
781 if ( fVerbose ) printf( "Trying medium synthesis...\n" );
783 if ( fVerbose )
785 }
786
787 if ( Gia_ManAndNum( Abc_FrameReadGia(Abc_FrameGetGlobalFrame()) ) < 10000 )
788 {
789 if ( fVerbose ) printf( "Trying harder synthesis...\n" );
791 if ( fVerbose )
793 }
794
795 if ( fVerbose ) printf( "Final result...\n" );
796 if ( fVerbose )
798}
799
800
801
805
806
808
ABC_DLL int Abc_NtkRecIsRunning3()
Definition abcRec3.c:1395
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
Aig_Man_t * Aig_ManDupDfsGuided(Aig_Man_t *p, Vec_Ptr_t *vPios)
Definition aigDup.c:694
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
ABC_DLL Gia_Man_t * Abc_FrameReadGia(Abc_Frame_t *p)
Definition mainFrame.c:343
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
void * Dsm_ManDeriveGia(void *p, int fUseMuxes)
Definition dauGia.c:503
typedefABC_NAMESPACE_HEADER_START struct Dch_Pars_t_ Dch_Pars_t
INCLUDES ///.
Definition dch.h:43
Aig_Man_t * Dch_ComputeChoices(Aig_Man_t *pAig, Dch_Pars_t *pPars)
Definition dchCore.c:89
Cube * p
Definition exorList.c:222
Gia_Man_t * Gia_ManFromAigChoices(Aig_Man_t *p)
Definition giaAig.c:170
Aig_Man_t * Gia_ManToAigSkip(Gia_Man_t *p, int nOutDelta)
Definition giaAig.c:365
Gia_Man_t * Gia_ManAigSynch2Choices(Gia_Man_t *pGia1, Gia_Man_t *pGia2, Gia_Man_t *pGia3, Dch_Pars_t *pPars)
Definition giaScript.c:374
void Gia_ManPerformFlow3(int nLutSize, int nCutNum, int fBalance, int fMinAve, int fUseMfs, int fUseLutLib, int fVerbose)
Definition giaScript.c:758
Vec_Ptr_t * Gia_ManOrderPios(Aig_Man_t *p, Gia_Man_t *pOrder)
Definition giaScript.c:253
void Gia_ManPerformFlow(int fIsMapped, int nAnds, int nLevels, int nLutSize, int nCutNum, int fMinAve, int fUseMfs, int fVerbose)
Definition giaScript.c:594
Gia_Man_t * Gia_ManAigSynch2(Gia_Man_t *pInit, void *pPars0, int nLutSize, int nRelaxRatio)
Definition giaScript.c:401
ABC_NAMESPACE_IMPL_START void Gia_ManAigPrintPiLevels(Gia_Man_t *p)
DECLARATIONS ///.
Definition giaScript.c:49
void Gia_ManPerformRound(int fIsMapped, int nAnds, int nLevels, int nLutSize, int nCutNum, int fMinAve, int fUseMfs, int fVerbose)
Definition giaScript.c:541
Gia_Man_t * Gia_ManDupFromBarBufs(Gia_Man_t *p)
Definition giaScript.c:282
Gia_Man_t * Gia_ManAigSyn3(Gia_Man_t *p, int fVerbose, int fVeryVerbose)
Definition giaScript.c:157
Gia_Man_t * Gia_ManAigSyn2(Gia_Man_t *pInit, int fOldAlgo, int fCoarsen, int fCutMin, int nRelaxRatio, int fDelayMin, int fVerbose, int fVeryVerbose)
Definition giaScript.c:69
Gia_Man_t * Gia_ManAigSyn4(Gia_Man_t *p, int fVerbose, int fVeryVerbose)
Definition giaScript.c:194
Gia_Man_t * Gia_ManDupToBarBufs(Gia_Man_t *p, int nBarBufs)
Definition giaScript.c:320
void Gia_ManPerformFlow2(int fIsMapped, int nAnds, int nLevels, int nLutSize, int nCutNum, int fBalance, int fMinAve, int fUseMfs, int fVerbose)
Definition giaScript.c:625
void Gia_ManPerformMap(int nAnds, int nLutSize, int nCutNum, int fMinAve, int fUseMfs, int fVerbose)
Definition giaScript.c:501
Gia_Man_t * Gia_ManLutBalance(Gia_Man_t *p, int nLutSize, int fUseMuxes, int fRecursive, int fOptArea, int fVerbose)
Definition giaStr.c:1384
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
void Jf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition giaJf.c:1682
Gia_Man_t * Gia_ManPerformFx(Gia_Man_t *p, int nNewNodesMax, int LitCountMax, int fReverse, int fVerbose, int fVeryVerbose)
Definition giaFx.c:465
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
Gia_Man_t * Gia_ManAreaBalance(Gia_Man_t *p, int fSimpleAnd, int nNewNodesMax, int fVerbose, int fVeryVerbose)
Definition giaBalAig.c:1047
int Gia_ManLevelWithBoxes(Gia_Man_t *p)
Definition giaTim.c:478
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
Gia_Man_t * Gia_ManChoiceMiter(Vec_Ptr_t *vGias)
Definition giaDup.c:3763
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Lf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaLf.c:2242
Gia_Man_t * Jf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaJf.c:1715
Gia_Man_t * Gia_ManPerformDsdBalance(Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
Definition giaIf.c:2678
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
void Lf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition giaLf.c:2021
struct Jf_Par_t_ Jf_Par_t
Definition gia.h:333
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition giaMan.c:495
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2305
Vec_Int_t * vLevels
Definition gia.h:120
int * pSibls
Definition gia.h:128
char * pSpec
Definition gia.h:100
void * pManTime
Definition gia.h:194
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
int nRelaxRatio
Definition gia.h:341
int nCutNum
Definition gia.h:337
int fCoarsen
Definition gia.h:357
int nLutSize
Definition gia.h:336
word Delay
Definition gia.h:376
int nAreaTuner
Definition gia.h:343
int fCutMin
Definition gia.h:358
word Area
Definition gia.h:377
int fVerbose
Definition gia.h:370
#define assert(ex)
Definition util_old.h:213
char * sprintf()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42