ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
decUtil.c File Reference
#include "base/abc/abc.h"
#include "dec.h"
Include dependency graph for decUtil.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START unsigned Dec_GraphDeriveTruth (Dec_Graph_t *pGraph)
 DECLARATIONS ///.
 

Function Documentation

◆ Dec_GraphDeriveTruth()

ABC_NAMESPACE_IMPL_START unsigned Dec_GraphDeriveTruth ( Dec_Graph_t * pGraph)

DECLARATIONS ///.

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

FileName [decUtil.c]

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

Synopsis [Decomposition unitilies.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id
decUtil.c,v 1.1 2003/05/22 19:20:05 alanmi Exp

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

Synopsis [Derives the truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file decUtil.c.

103{
104 unsigned uTruths[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
105 unsigned uTruth = 0; // Suppress "might be used uninitialized"
106 unsigned uTruth0, uTruth1;
107 Dec_Node_t * pNode;
108 int i;
109
110 // sanity checks
111 assert( Dec_GraphLeaveNum(pGraph) >= 0 );
112 assert( Dec_GraphLeaveNum(pGraph) <= pGraph->nSize );
113 assert( Dec_GraphLeaveNum(pGraph) <= 5 );
114
115 // check for constant function
116 if ( Dec_GraphIsConst(pGraph) )
117 return Dec_GraphIsComplement(pGraph)? 0 : ~((unsigned)0);
118 // check for a literal
119 if ( Dec_GraphIsVar(pGraph) )
120 return Dec_GraphIsComplement(pGraph)? ~uTruths[Dec_GraphVarInt(pGraph)] : uTruths[Dec_GraphVarInt(pGraph)];
121
122 // assign the elementary variables
123 Dec_GraphForEachLeaf( pGraph, pNode, i )
124 pNode->pFunc = (void *)(ABC_PTRUINT_T)uTruths[i];
125
126 // compute the function for each internal node
127 Dec_GraphForEachNode( pGraph, pNode, i )
128 {
129 uTruth0 = (unsigned)(ABC_PTRUINT_T)Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc;
130 uTruth1 = (unsigned)(ABC_PTRUINT_T)Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc;
131 uTruth0 = pNode->eEdge0.fCompl? ~uTruth0 : uTruth0;
132 uTruth1 = pNode->eEdge1.fCompl? ~uTruth1 : uTruth1;
133 uTruth = uTruth0 & uTruth1;
134 pNode->pFunc = (void *)(ABC_PTRUINT_T)uTruth;
135 }
136
137 // complement the result if necessary
138 return Dec_GraphIsComplement(pGraph)? ~uTruth : uTruth;
139}
struct Dec_Node_t_ Dec_Node_t
Definition dec.h:49
#define Dec_GraphForEachLeaf(pGraph, pLeaf, i)
ITERATORS ///.
Definition dec.h:98
#define Dec_GraphForEachNode(pGraph, pAnd, i)
Definition dec.h:101
int nSize
Definition dec.h:73
Dec_Edge_t eEdge1
Definition dec.h:53
void * pFunc
Definition dec.h:56
Dec_Edge_t eEdge0
Definition dec.h:52
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function: