abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cnfData.c File Reference
#include "cnf.h"

Go to the source code of this file.

Functions

void Cnf_ReadMsops (char **ppSopSizes, char ***ppSops)
 FUNCTION DEFINITIONS ///. More...
 

Variables

static
ABC_NAMESPACE_IMPL_START const
char 
s_Data3 [82] = "!#&()*+,-.0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz|"
 DECLARATIONS ///. More...
 
static const 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 4537 of file cnfData.c.

4538 {
4539  unsigned uMasks[4][2] = {
4540  { 0x5555, 0xAAAA },
4541  { 0x3333, 0xCCCC },
4542  { 0x0F0F, 0xF0F0 },
4543  { 0x00FF, 0xFF00 }
4544  };
4545  char Map[256], * pPrev, * pMemory;
4546  char * pSopSizes, ** pSops;
4547  int i, k, b, Size;
4548 
4549  // map chars into their numbers
4550  for ( i = 0; i < 256; i++ )
4551  Map[i] = (char)(-1);
4552  for ( i = 0; i < 81; i++ )
4553  Map[(int)s_Data3[i]] = (char)i;
4554 
4555  // count the number of strings
4556  for ( Size = 0; s_Data4[Size] && Size < 100000; Size++ );
4557  assert( Size < 100000 );
4558 
4559  // allocate memory
4560  pMemory = ABC_ALLOC( char, Size * 75 );
4561  // copy the array into memory
4562  for ( i = 0; i < Size; i++ )
4563  for ( k = 0; k < 75; k++ )
4564  if ( s_Data4[i][k] == ' ' )
4565  pMemory[i*75+k] = (char)(-1);
4566  else
4567  pMemory[i*75+k] = Map[(int)s_Data4[i][k]];
4568 
4569  // set pointers and compute SOP sizes
4570  pSopSizes = ABC_ALLOC( char, 65536 );
4571  pSops = ABC_ALLOC( char *, 65536 );
4572  pSopSizes[0] = 0;
4573  pSops[0] = NULL;
4574  pPrev = pMemory;
4575  for ( k = 0, i = 1; i < 65536; k++ )
4576  if ( pMemory[k] == (char)(-1) )
4577  {
4578  pSopSizes[i] = pMemory + k - pPrev;
4579  pSops[i++] = pPrev;
4580  pPrev = pMemory + k + 1;
4581  }
4582  *ppSopSizes = pSopSizes;
4583  *ppSops = pSops;
4584 
4585  // verify the results - derive truth table from SOP
4586  for ( i = 1; i < 65536; i++ )
4587  {
4588  int uTruth = 0, uCube, Lit;
4589  for ( k = 0; k < pSopSizes[i]; k++ )
4590  {
4591  uCube = 0xFFFF;
4592  Lit = pSops[i][k];
4593  for ( b = 3; b >= 0; b-- )
4594  {
4595  if ( Lit % 3 == 0 )
4596  uCube &= uMasks[b][0];
4597  else if ( Lit % 3 == 1 )
4598  uCube &= uMasks[b][1];
4599  Lit = Lit / 3;
4600  }
4601  uTruth |= uCube;
4602  }
4603  assert( uTruth == i );
4604  }
4605 }
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static ABC_NAMESPACE_IMPL_START const char s_Data3[82]
DECLARATIONS ///.
Definition: cnfData.c:30
static const char * s_Data4[]
Definition: cnfData.c:32
#define assert(ex)
Definition: util_old.h:213

Variable Documentation

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

DECLARATIONS ///.

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

]

Definition at line 30 of file cnfData.c.

const char* s_Data4[]
static

Definition at line 32 of file cnfData.c.