ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mapperTruth.c File Reference
#include "mapperInt.h"
Include dependency graph for mapperTruth.c:

Go to the source code of this file.

Functions

void Map_TruthsCutOne (Map_Man_t *p, Map_Cut_t *pCut, unsigned uTruth[])
 
void Map_MappingTruths (Map_Man_t *pMan)
 FUNCTION DEFINITIONS ///.
 

Function Documentation

◆ Map_MappingTruths()

void Map_MappingTruths ( Map_Man_t * pMan)

FUNCTION DEFINITIONS ///.

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

Synopsis [Derives truth tables for each cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file mapperTruth.c.

48{
49 ProgressBar * pProgress;
50 Map_Node_t * pNode;
51 Map_Cut_t * pCut;
52 int nNodes, i;
53 // compute the cuts for the POs
54 nNodes = pMan->vMapObjs->nSize;
55 pProgress = Extra_ProgressBarStart( stdout, nNodes );
56 for ( i = 0; i < nNodes; i++ )
57 {
58 pNode = pMan->vMapObjs->pArray[i];
59 if ( !Map_NodeIsAnd( pNode ) )
60 continue;
61 assert( pNode->pCuts );
62 assert( pNode->pCuts->nLeaves == 1 );
63
64 // match the simple cut
65 pNode->pCuts->M[0].uPhase = 0;
66 pNode->pCuts->M[0].pSupers = pMan->pSuperLib->pSuperInv;
67 pNode->pCuts->M[0].uPhaseBest = 0;
68 pNode->pCuts->M[0].pSuperBest = pMan->pSuperLib->pSuperInv;
69
70 pNode->pCuts->M[1].uPhase = 0;
71 pNode->pCuts->M[1].pSupers = pMan->pSuperLib->pSuperInv;
72 pNode->pCuts->M[1].uPhaseBest = 1;
73 pNode->pCuts->M[1].pSuperBest = pMan->pSuperLib->pSuperInv;
74
75 // match the rest of the cuts
76 for ( pCut = pNode->pCuts->pNext; pCut; pCut = pCut->pNext )
77 Map_TruthsCut( pMan, pCut );
78 Extra_ProgressBarUpdate( pProgress, i, "Tables ..." );
79 }
80 Extra_ProgressBarStop( pProgress );
81}
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
struct Map_CutStruct_t_ Map_Cut_t
Definition mapper.h:43
int Map_NodeIsAnd(Map_Node_t *p)
struct Map_NodeStruct_t_ Map_Node_t
Definition mapper.h:41
Map_Match_t M[2]
Definition mapperInt.h:275
Map_Cut_t * pNext
Definition mapperInt.h:266
Map_Super_t * pSupers
Definition mapperInt.h:253
Map_Super_t * pSuperBest
Definition mapperInt.h:257
unsigned uPhaseBest
Definition mapperInt.h:256
Map_Cut_t * pCuts
Definition mapperInt.h:244
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_TruthsCutOne()

void Map_TruthsCutOne ( Map_Man_t * p,
Map_Cut_t * pCut,
unsigned uTruth[] )
extern

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

Synopsis [Computes the truth table of one cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 197 of file mapperTruth.c.

198{
199 unsigned uTruth1[2], uTruth2[2];
200 Map_Cut_t * pTemp = NULL; // Suppress "might be used uninitialized"
201 int i;
202 // mark the cut leaves
203 for ( i = 0; i < pCut->nLeaves; i++ )
204 {
205 pTemp = pCut->ppLeaves[i]->pCuts;
206 pTemp->fMark = 1;
207 pTemp->M[0].uPhaseBest = p->uTruths[i][0];
208 pTemp->M[1].uPhaseBest = p->uTruths[i][1];
209 }
210 assert( pCut->fMark == 0 );
211
212 // collect the cuts in the cut cone
213 p->vVisited->nSize = 0;
214 Map_CutsCollect_rec( pCut, p->vVisited );
215 assert( p->vVisited->nSize > 0 );
216 pCut->nVolume = p->vVisited->nSize;
217
218 // compute the tables and unmark
219 for ( i = 0; i < pCut->nLeaves; i++ )
220 {
221 pTemp = pCut->ppLeaves[i]->pCuts;
222 pTemp->fMark = 0;
223 }
224 for ( i = 0; i < p->vVisited->nSize; i++ )
225 {
226 // get the cut
227 pTemp = (Map_Cut_t *)p->vVisited->pArray[i];
228 pTemp->fMark = 0;
229 // get truth table of the first branch
230 if ( Map_CutIsComplement(pTemp->pOne) )
231 {
232 uTruth1[0] = ~Map_CutRegular(pTemp->pOne)->M[0].uPhaseBest;
233 uTruth1[1] = ~Map_CutRegular(pTemp->pOne)->M[1].uPhaseBest;
234 }
235 else
236 {
237 uTruth1[0] = Map_CutRegular(pTemp->pOne)->M[0].uPhaseBest;
238 uTruth1[1] = Map_CutRegular(pTemp->pOne)->M[1].uPhaseBest;
239 }
240 // get truth table of the second branch
241 if ( Map_CutIsComplement(pTemp->pTwo) )
242 {
243 uTruth2[0] = ~Map_CutRegular(pTemp->pTwo)->M[0].uPhaseBest;
244 uTruth2[1] = ~Map_CutRegular(pTemp->pTwo)->M[1].uPhaseBest;
245 }
246 else
247 {
248 uTruth2[0] = Map_CutRegular(pTemp->pTwo)->M[0].uPhaseBest;
249 uTruth2[1] = Map_CutRegular(pTemp->pTwo)->M[1].uPhaseBest;
250 }
251 // get the truth table of the output
252 if ( !pTemp->Phase )
253 {
254 pTemp->M[0].uPhaseBest = uTruth1[0] & uTruth2[0];
255 pTemp->M[1].uPhaseBest = uTruth1[1] & uTruth2[1];
256 }
257 else
258 {
259 pTemp->M[0].uPhaseBest = ~(uTruth1[0] & uTruth2[0]);
260 pTemp->M[1].uPhaseBest = ~(uTruth1[1] & uTruth2[1]);
261 }
262 }
263 uTruth[0] = pTemp->M[0].uPhaseBest;
264 uTruth[1] = pTemp->M[1].uPhaseBest;
265}
Cube * p
Definition exorList.c:222
#define Map_CutRegular(p)
Definition mapperInt.h:69
#define Map_CutIsComplement(p)
Definition mapperInt.h:68
Map_Cut_t * pTwo
Definition mapperInt.h:268
Map_Node_t * ppLeaves[6]
Definition mapperInt.h:269
Map_Cut_t * pOne
Definition mapperInt.h:267