abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fpgaTruth.c File Reference
#include "fpgaInt.h"
#include "bdd/cudd/cudd.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START DdNodeFpga_TruthsCutBdd_rec (DdManager *dd, Fpga_Cut_t *pCut, Fpga_NodeVec_t *vVisited)
 DECLARATIONS ///. More...
 
void * Fpga_TruthsCutBdd (void *dd, Fpga_Cut_t *pCut)
 
void Fpga_CutVolume_rec (Fpga_Cut_t *pCut, Fpga_NodeVec_t *vVisited)
 
int Fpga_CutVolume (Fpga_Cut_t *pCut)
 

Function Documentation

int Fpga_CutVolume ( Fpga_Cut_t pCut)

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

Synopsis [Derives the truth table for one cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 140 of file fpgaTruth.c.

141 {
142  Fpga_NodeVec_t * vVisited;
143  int Volume, i;
144  assert( pCut->nLeaves > 1 );
145  // set the leaf variables
146  for ( i = 0; i < pCut->nLeaves; i++ )
147  pCut->ppLeaves[i]->pCuts->fMark = 1;
148  // recursively compute the function
149  vVisited = Fpga_NodeVecAlloc( 10 );
150  Fpga_CutVolume_rec( pCut, vVisited );
151  // clean the marks
152  for ( i = 0; i < pCut->nLeaves; i++ )
153  pCut->ppLeaves[i]->pCuts->fMark = 0;
154  for ( i = 0; i < vVisited->nSize; i++ )
155  {
156  pCut = (Fpga_Cut_t *)vVisited->pArray[i];
157  pCut->fMark = 0;
158  }
159  Volume = vVisited->nSize;
160  printf( "%d ", Volume );
161  Fpga_NodeVecFree( vVisited );
162  return Volume;
163 }
for(p=first;p->value< newval;p=p->next)
Fpga_Cut_t * pCuts
Definition: fpgaInt.h:224
void Fpga_CutVolume_rec(Fpga_Cut_t *pCut, Fpga_NodeVec_t *vVisited)
Definition: fpgaTruth.c:118
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition: fpgaInt.h:237
Fpga_NodeVec_t * Fpga_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: fpgaVec.c:45
void Fpga_NodeVecFree(Fpga_NodeVec_t *p)
Definition: fpgaVec.c:68
#define assert(ex)
Definition: util_old.h:213
Fpga_Node_t ** pArray
Definition: fpgaInt.h:252
void Fpga_CutVolume_rec ( Fpga_Cut_t pCut,
Fpga_NodeVec_t vVisited 
)

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

Synopsis [Recursively derives the truth table for the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 118 of file fpgaTruth.c.

119 {
120  assert( !Fpga_IsComplement(pCut) );
121  if ( pCut->fMark )
122  return;
123  pCut->fMark = 1;
124  Fpga_CutVolume_rec( Fpga_CutRegular(pCut->pOne), vVisited );
125  Fpga_CutVolume_rec( Fpga_CutRegular(pCut->pTwo), vVisited );
126  Fpga_NodeVecPush( vVisited, (Fpga_Node_t *)pCut );
127 }
#define Fpga_CutRegular(p)
Definition: fpgaInt.h:74
Fpga_Cut_t * pTwo
Definition: fpgaInt.h:235
void Fpga_CutVolume_rec(Fpga_Cut_t *pCut, Fpga_NodeVec_t *vVisited)
Definition: fpgaTruth.c:118
Fpga_Cut_t * pOne
Definition: fpgaInt.h:234
#define assert(ex)
Definition: util_old.h:213
#define Fpga_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fpga.h:57
void Fpga_NodeVecPush(Fpga_NodeVec_t *p, Fpga_Node_t *Entry)
Definition: fpgaVec.c:169
void* Fpga_TruthsCutBdd ( void *  dd,
Fpga_Cut_t pCut 
)

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

Synopsis [Derives the truth table for one cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file fpgaTruth.c.

80 {
81  Fpga_NodeVec_t * vVisited;
82  DdNode * bFunc;
83  int i;
84  assert( pCut->nLeaves > 1 );
85  // set the leaf variables
86  for ( i = 0; i < pCut->nLeaves; i++ )
87  pCut->ppLeaves[i]->pCuts->uSign = (unsigned)(ABC_PTRUINT_T)Cudd_bddIthVar( (DdManager *)dd, i );
88  // recursively compute the function
89  vVisited = Fpga_NodeVecAlloc( 10 );
90  bFunc = Fpga_TruthsCutBdd_rec( (DdManager *)dd, pCut, vVisited ); Cudd_Ref( bFunc );
91  // clean the intermediate BDDs
92  for ( i = 0; i < pCut->nLeaves; i++ )
93  pCut->ppLeaves[i]->pCuts->uSign = 0;
94  for ( i = 0; i < vVisited->nSize; i++ )
95  {
96  pCut = (Fpga_Cut_t *)vVisited->pArray[i];
97  Cudd_RecursiveDeref( (DdManager *)dd, (DdNode*)(ABC_PTRUINT_T)pCut->uSign );
98  pCut->uSign = 0;
99  }
100 // printf( "%d ", vVisited->nSize );
101  Fpga_NodeVecFree( vVisited );
102  Cudd_Deref( bFunc );
103  return bFunc;
104 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
for(p=first;p->value< newval;p=p->next)
Fpga_Cut_t * pCuts
Definition: fpgaInt.h:224
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition: fpgaInt.h:237
Fpga_NodeVec_t * Fpga_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: fpgaVec.c:45
void Fpga_NodeVecFree(Fpga_NodeVec_t *p)
Definition: fpgaVec.c:68
unsigned uSign
Definition: fpgaInt.h:239
ABC_NAMESPACE_IMPL_START DdNode * Fpga_TruthsCutBdd_rec(DdManager *dd, Fpga_Cut_t *pCut, Fpga_NodeVec_t *vVisited)
DECLARATIONS ///.
Definition: fpgaTruth.c:44
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
#define assert(ex)
Definition: util_old.h:213
Fpga_Node_t ** pArray
Definition: fpgaInt.h:252
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_NAMESPACE_IMPL_START DdNode* Fpga_TruthsCutBdd_rec ( DdManager dd,
Fpga_Cut_t pCut,
Fpga_NodeVec_t vVisited 
)

DECLARATIONS ///.

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

FileName [fpgaTruth.c]

PackageName [MVSIS 1.3: Multi-valued logic synthesis system.]

Synopsis [Technology mapping for variable-size-LUT FPGAs.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 2.0. Started - August 18, 2004.]

Revision [

Id:
fpgaTruth.c,v 1.4 2005/01/23 06:59:42 alanmi Exp

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

Synopsis [Recursively derives the truth table for the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file fpgaTruth.c.

45 {
46  DdNode * bFunc, * bFunc0, * bFunc1;
47  assert( !Fpga_IsComplement(pCut) );
48  // if the cut is visited, return the result
49  if ( pCut->uSign )
50  return (DdNode *)(ABC_PTRUINT_T)pCut->uSign;
51  // compute the functions of the children
52  bFunc0 = Fpga_TruthsCutBdd_rec( dd, Fpga_CutRegular(pCut->pOne), vVisited ); Cudd_Ref( bFunc0 );
53  bFunc0 = Cudd_NotCond( bFunc0, Fpga_CutIsComplement(pCut->pOne) );
54  bFunc1 = Fpga_TruthsCutBdd_rec( dd, Fpga_CutRegular(pCut->pTwo), vVisited ); Cudd_Ref( bFunc1 );
55  bFunc1 = Cudd_NotCond( bFunc1, Fpga_CutIsComplement(pCut->pTwo) );
56  // get the function of the cut
57  bFunc = Cudd_bddAnd( dd, bFunc0, bFunc1 ); Cudd_Ref( bFunc );
58  bFunc = Cudd_NotCond( bFunc, pCut->Phase );
59  Cudd_RecursiveDeref( dd, bFunc0 );
60  Cudd_RecursiveDeref( dd, bFunc1 );
61  assert( pCut->uSign == 0 );
62  pCut->uSign = (unsigned)(ABC_PTRUINT_T)bFunc;
63  // add this cut to the visited list
64  Fpga_NodeVecPush( vVisited, (Fpga_Node_t *)pCut );
65  return bFunc;
66 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Fpga_CutRegular(p)
Definition: fpgaInt.h:74
Fpga_Cut_t * pTwo
Definition: fpgaInt.h:235
#define Fpga_CutIsComplement(p)
Definition: fpgaInt.h:73
Fpga_Cut_t * pOne
Definition: fpgaInt.h:234
unsigned uSign
Definition: fpgaInt.h:239
ABC_NAMESPACE_IMPL_START DdNode * Fpga_TruthsCutBdd_rec(DdManager *dd, Fpga_Cut_t *pCut, Fpga_NodeVec_t *vVisited)
DECLARATIONS ///.
Definition: fpgaTruth.c:44
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Fpga_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: fpga.h:57
void Fpga_NodeVecPush(Fpga_NodeVec_t *p, Fpga_Node_t *Entry)
Definition: fpgaVec.c:169