src/aig/cnf/cnfData.c File Reference

#include "cnf.h"
Include dependency graph for cnfData.c:

Go to the source code of this file.

Functions

void Cnf_ReadMsops (char **ppSopSizes, char ***ppSops)

Variables

static char s_Data3 [81] = "!#&()*+,-.0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz|"
static char * s_Data4 []

Function Documentation

void Cnf_ReadMsops ( char **  ppSopSizes,
char ***  ppSops 
)

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Prepares the data for MSOPs of 4-variable functions.]

Description []

SideEffects []

SeeAlso []

Definition at line 4534 of file cnfData.c.

04535 {
04536     unsigned uMasks[4][2] = {
04537         { 0x5555, 0xAAAA },
04538         { 0x3333, 0xCCCC },
04539         { 0x0F0F, 0xF0F0 },
04540         { 0x00FF, 0xFF00 }
04541     };
04542     char Map[256], * pPrev, * pMemory;
04543     char * pSopSizes, ** pSops;
04544     int i, k, b, Size;
04545 
04546     // map chars into their numbers
04547     for ( i = 0; i < 256; i++ )
04548         Map[i] = -1;
04549     for ( i = 0; i < 81; i++ )
04550         Map[s_Data3[i]] = i;
04551 
04552     // count the number of strings
04553     for ( Size = 0; s_Data4[Size] && Size < 100000; Size++ );
04554     assert( Size < 100000 );
04555 
04556     // allocate memory
04557     pMemory = ALLOC( char, Size * 75 );
04558     // copy the array into memory
04559     for ( i = 0; i < Size; i++ )
04560         for ( k = 0; k < 75; k++ )
04561             if ( s_Data4[i][k] == ' ' )
04562                 pMemory[i*75+k] = -1;
04563             else
04564                 pMemory[i*75+k] = Map[s_Data4[i][k]];
04565 
04566     // set pointers and compute SOP sizes
04567     pSopSizes = ALLOC( char, 65536 );
04568     pSops = ALLOC( char *, 65536 );
04569     pSopSizes[0] = 0;
04570     pSops[0] = NULL;
04571     pPrev = pMemory;
04572     for ( k = 0, i = 1; i < 65536; k++ )
04573         if ( pMemory[k] == -1 )
04574         {
04575             pSopSizes[i] = pMemory + k - pPrev; 
04576             pSops[i++] = pPrev;
04577             pPrev = pMemory + k + 1;
04578         }
04579     *ppSopSizes = pSopSizes;
04580     *ppSops = pSops;
04581 
04582     // verify the results - derive truth table from SOP
04583     for ( i = 1; i < 65536; i++ )
04584     {
04585         int uTruth = 0, uCube, Lit;
04586         for ( k = 0; k < pSopSizes[i]; k++ )
04587         {
04588             uCube = 0xFFFF;
04589             Lit = pSops[i][k];
04590             for ( b = 3; b >= 0; b-- )
04591             {
04592                 if ( Lit % 3 == 0 )
04593                     uCube &= uMasks[b][0];
04594                 else if ( Lit % 3 == 1 )
04595                     uCube &= uMasks[b][1];
04596                 Lit = Lit / 3;
04597             }
04598             uTruth |= uCube;
04599         }
04600         assert( uTruth == i );
04601     }
04602 }


Variable Documentation

char s_Data3[81] = "!#&()*+,-.0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz|" [static]

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

FileName [cnfData.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG-to-CNF conversion.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id
cnfData.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

] DECLARATIONS ///

Definition at line 27 of file cnfData.c.

char* s_Data4[] [static]

Definition at line 29 of file cnfData.c.


Generated on Tue Jan 5 12:18:14 2010 for abc70930 by  doxygen 1.6.1