ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
ifDec10.c File Reference
#include "if.h"
#include "misc/extra/extra.h"
#include "bool/kit/kit.h"
Include dependency graph for ifDec10.c:

Go to the source code of this file.

Functions

void If_Dec10PrintConfig (unsigned *pZ)
 
void If_Dec10Verify (word *pF, int nVars, unsigned *pZ)
 
void If_Dec10Cofactors (word *pF, int nVars, int iVar, word *pCof0, word *pCof1)
 
int If_Dec10Perform (word *pF, int nVars, int fDerive)
 
int If_CutPerformCheck10 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 

Function Documentation

◆ If_CutPerformCheck10()

int If_CutPerformCheck10 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )

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

Synopsis [Performs additional check.]

Description []

SideEffects []

SeeAlso []

Definition at line 474 of file ifDec10.c.

475{
476 int nSupp, fDerive = 0;
477 word pF[16];
478 if ( nLeaves <= 6 )
479 return 1;
480 If_Dec10Copy( pF, (word *)pTruth, nVars );
481 nSupp = If_Dec10Support( pF, nLeaves );
482 if ( !nSupp || !If_DecSuppIsMinBase(nSupp) )
483 return 0;
484 if ( If_Dec10Perform( pF, nLeaves, fDerive ) )
485 {
486// printf( "1" );
487 return 1;
488// If_Dec10Verify( t, nLeaves, NULL );
489 }
490// printf( "0" );
491 return 0;
492}
int If_Dec10Perform(word *pF, int nVars, int fDerive)
Definition ifDec10.c:376
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the call graph for this function:

◆ If_Dec10Cofactors()

void If_Dec10Cofactors ( word * pF,
int nVars,
int iVar,
word * pCof0,
word * pCof1 )

Definition at line 334 of file ifDec10.c.

335{
336 int nWords = If_Dec10WordNum( nVars );
337 assert( iVar < nVars );
338 if ( iVar < 6 )
339 {
340 int i, Shift = (1 << iVar);
341 for ( i = 0; i < nWords; i++ )
342 {
343 pCof0[i] = (pF[i] & ~Truth6[iVar]) | ((pF[i] & ~Truth6[iVar]) << Shift);
344 pCof1[i] = (pF[i] & Truth6[iVar]) | ((pF[i] & Truth6[iVar]) >> Shift);
345 }
346 return;
347 }
348 else
349 {
350 int i, k, Step = (1 << (iVar - 6));
351 for ( k = 0; k < nWords; k += 2*Step )
352 {
353 for ( i = 0; i < Step; i++ )
354 {
355 pCof0[i] = pCof0[Step+i] = pF[i];
356 pCof1[i] = pCof1[Step+i] = pF[Step+i];
357 }
358 pF += 2*Step;
359 pCof0 += 2*Step;
360 pCof1 += 2*Step;
361 }
362 return;
363 }
364}
int nWords
Definition abcNpn.c:127
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ If_Dec10Perform()

int If_Dec10Perform ( word * pF,
int nVars,
int fDerive )

Definition at line 376 of file ifDec10.c.

377{
378// static int Cnt = 0;
379 word pCof0[16], pCof1[16];
380 int Pla2Var[10], Var2Pla[10], Count[210], Masks[210];
381 int i, i0,i1,i2,i3, v, x;
382 assert( nVars >= 6 && nVars <= 10 );
383 // start arrays
384 for ( i = 0; i < nVars; i++ )
385 {
386 assert( If_Dec10HasVar( pF, nVars, i ) );
387 Pla2Var[i] = Var2Pla[i] = i;
388 }
389/*
390 Cnt++;
391//if ( Cnt == 108 )
392{
393printf( "%d\n", Cnt );
394//Extra_PrintHex( stdout, (unsigned *)pF, nVars );
395//printf( "\n" );
396Kit_DsdPrintFromTruth( (unsigned *)pF, nVars );
397printf( "\n" );
398printf( "\n" );
399}
400*/
401 // generate permutations
402 v = 0;
403 for ( i0 = 0; i0 < nVars; i0++ )
404 for ( i1 = i0+1; i1 < nVars; i1++ )
405 for ( i2 = i1+1; i2 < nVars; i2++ )
406 for ( i3 = i2+1; i3 < nVars; i3++, v++ )
407 {
408 If_Dec10MoveTo( pF, nVars, i0, nVars-1, Pla2Var, Var2Pla );
409 If_Dec10MoveTo( pF, nVars, i1, nVars-2, Pla2Var, Var2Pla );
410 If_Dec10MoveTo( pF, nVars, i2, nVars-3, Pla2Var, Var2Pla );
411 If_Dec10MoveTo( pF, nVars, i3, nVars-4, Pla2Var, Var2Pla );
412 If_DecVerifyPerm( Pla2Var, Var2Pla, nVars );
413 Count[v] = If_Dec10CofCount( pF, nVars );
414 Masks[v] = (1 << i0) | (1 << i1) | (1 << i2) | (1 << i3);
415 assert( Count[v] > 1 );
416//printf( "%d ", Count[v] );
417 if ( Count[v] == 2 || Count[v] > 5 )
418 continue;
419 for ( x = 0; x < 4; x++ )
420 {
421 If_Dec10Cofactors( pF, nVars, nVars-1-x, pCof0, pCof1 );
422 if ( If_Dec10CofCount2(pCof0, nVars) <= 2 && If_Dec10CofCount2(pCof1, nVars) <= 2 )
423 {
424 Count[v] = -Count[v];
425 break;
426 }
427 }
428 }
429//printf( "\n" );
430 assert( v <= 210 );
431 // check if there are compatible bound sets
432 for ( i0 = 0; i0 < v; i0++ )
433 for ( i1 = i0+1; i1 < v; i1++ )
434 {
435 if ( If_Dec10Count16(Masks[i0] & Masks[i1]) > 10 - nVars )
436 continue;
437 if ( nVars == 10 )
438 {
439 if ( Count[i0] == 2 && Count[i1] == 2 )
440 return 1;
441 }
442 else if ( nVars == 9 )
443 {
444 if ( (Count[i0] == 2 && Count[i1] == 2) ||
445 (Count[i0] == 2 && Count[i1] < 0) ||
446 (Count[i0] < 0 && Count[i1] == 2) )
447 return 1;
448 }
449 else
450 {
451 if ( (Count[i0] == 2 && Count[i1] == 2) ||
452 (Count[i0] == 2 && Count[i1] < 0) ||
453 (Count[i0] < 0 && Count[i1] == 2) ||
454 (Count[i0] < 0 && Count[i1] < 0) )
455 return 1;
456 }
457 }
458// printf( "not found\n" );
459 return 0;
460}
void If_Dec10Cofactors(word *pF, int nVars, int iVar, word *pCof0, word *pCof1)
Definition ifDec10.c:334
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_Dec10PrintConfig()

void If_Dec10PrintConfig ( unsigned * pZ)

Definition at line 89 of file ifDec10.c.

90{
91 while ( *pZ )
92 If_Dec10PrintConfigOne( *pZ++ );
93}
Here is the caller graph for this function:

◆ If_Dec10Verify()

void If_Dec10Verify ( word * pF,
int nVars,
unsigned * pZ )

Definition at line 115 of file ifDec10.c.

116{
117 word pN[16][16], * pG[4];
118 int i, w, v, k, nWords;
119 unsigned z;
120 nWords = If_Dec10WordNum( nVars );
121 for ( k = 0; k < nVars; k++ )
122 for ( w = 0; w < nWords; w++ )
123 pN[k][w] = Truth10[k][w];
124 for ( i = 0; (z = pZ[i]); i++, k++ )
125 {
126 for ( v = 0; v < 4; v++ )
127 pG[v] = pN[ (z >> (16+(v<<2))) & 7 ];
128 If_Dec10ComposeLut4( (int)(z & 0xffff), pG, pN[k], nVars );
129 }
130 k--;
131 for ( w = 0; w < nWords; w++ )
132 if ( pN[k][w] != pF[w] )
133 {
135 Kit_DsdPrintFromTruth( (unsigned*)pF, nVars ); printf( "\n" );
136 Kit_DsdPrintFromTruth( (unsigned*)pN[k], nVars ); printf( "\n" );
137 printf( "Verification failed!\n" );
138 break;
139 }
140}
void If_Dec10PrintConfig(unsigned *pZ)
Definition ifDec10.c:89
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition kitDsd.c:491
Here is the call graph for this function: