#include "mapperInt.h"
Go to the source code of this file.
Functions | |
static void | Map_TruthsCut (Map_Man_t *pMan, Map_Cut_t *pCut) |
void | Map_TruthsCutOne (Map_Man_t *p, Map_Cut_t *pCut, unsigned uTruth[]) |
static void | Map_CutsCollect_rec (Map_Cut_t *pCut, Map_NodeVec_t *vVisited) |
void | Map_MappingTruths (Map_Man_t *pMan) |
void Map_CutsCollect_rec | ( | Map_Cut_t * | pCut, | |
Map_NodeVec_t * | vVisited | |||
) | [static] |
Function*************************************************************
Synopsis [Recursively collect the cuts.]
Description []
SideEffects []
SeeAlso []
Definition at line 275 of file mapperTruth.c.
00276 { 00277 if ( pCut->fMark ) 00278 return; 00279 Map_CutsCollect_rec( Map_CutRegular(pCut->pOne), vVisited ); 00280 Map_CutsCollect_rec( Map_CutRegular(pCut->pTwo), vVisited ); 00281 assert( pCut->fMark == 0 ); 00282 pCut->fMark = 1; 00283 Map_NodeVecPush( vVisited, (Map_Node_t *)pCut ); 00284 }
void Map_MappingTruths | ( | Map_Man_t * | pMan | ) |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Derives truth tables for each cut.]
Description []
SideEffects []
SeeAlso []
Definition at line 44 of file mapperTruth.c.
00045 { 00046 ProgressBar * pProgress; 00047 Map_Node_t * pNode; 00048 Map_Cut_t * pCut; 00049 int nNodes, i; 00050 // compute the cuts for the POs 00051 nNodes = pMan->vAnds->nSize; 00052 pProgress = Extra_ProgressBarStart( stdout, nNodes ); 00053 for ( i = 0; i < nNodes; i++ ) 00054 { 00055 pNode = pMan->vAnds->pArray[i]; 00056 if ( !Map_NodeIsAnd( pNode ) ) 00057 continue; 00058 assert( pNode->pCuts ); 00059 assert( pNode->pCuts->nLeaves == 1 ); 00060 00061 // match the simple cut 00062 pNode->pCuts->M[0].uPhase = 0; 00063 pNode->pCuts->M[0].pSupers = pMan->pSuperLib->pSuperInv; 00064 pNode->pCuts->M[0].uPhaseBest = 0; 00065 pNode->pCuts->M[0].pSuperBest = pMan->pSuperLib->pSuperInv; 00066 00067 pNode->pCuts->M[1].uPhase = 0; 00068 pNode->pCuts->M[1].pSupers = pMan->pSuperLib->pSuperInv; 00069 pNode->pCuts->M[1].uPhaseBest = 1; 00070 pNode->pCuts->M[1].pSuperBest = pMan->pSuperLib->pSuperInv; 00071 00072 // match the rest of the cuts 00073 for ( pCut = pNode->pCuts->pNext; pCut; pCut = pCut->pNext ) 00074 Map_TruthsCut( pMan, pCut ); 00075 Extra_ProgressBarUpdate( pProgress, i, "Tables ..." ); 00076 } 00077 Extra_ProgressBarStop( pProgress ); 00078 }
CFile****************************************************************
FileName [mapperTruth.c]
PackageName [MVSIS 1.3: Multi-valued logic synthesis system.]
Synopsis [Generic technology mapping engine.]
Author [MVSIS Group]
Affiliation [UC Berkeley]
Date [Ver. 2.0. Started - June 1, 2004.]
Revision [
] DECLARATIONS ///
Function*************************************************************
Synopsis [Derives the truth table for one cut.]
Description []
SideEffects []
SeeAlso []
Definition at line 91 of file mapperTruth.c.
00092 { 00093 // unsigned uCanon1, uCanon2; 00094 unsigned uTruth[2], uCanon[2]; 00095 unsigned char uPhases[16]; 00096 unsigned * uCanon2; 00097 char * pPhases2; 00098 int fUseFast = 1; 00099 int fUseSlow = 0; 00100 int fUseRec = 0; // this does not work for Solaris 00101 00102 extern int Map_CanonCompute( int nVarsMax, int nVarsReal, unsigned * pt, unsigned ** pptRes, char ** ppfRes ); 00103 00104 // generally speaking, 1-input cut can be matched into a wire! 00105 if ( pCut->nLeaves == 1 ) 00106 return; 00107 /* 00108 if ( p->nVarsMax == 5 ) 00109 { 00110 uTruth[0] = pCut->uTruth; 00111 uTruth[1] = pCut->uTruth; 00112 } 00113 else 00114 */ 00115 Map_TruthsCutOne( p, pCut, uTruth ); 00116 00117 00118 // compute the canonical form for the positive phase 00119 if ( fUseFast ) 00120 Map_CanonComputeFast( p, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00121 else if ( fUseSlow ) 00122 Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00123 else if ( fUseRec ) 00124 { 00125 // Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00126 Extra_TruthCanonFastN( p->nVarsMax, pCut->nLeaves, uTruth, &uCanon2, &pPhases2 ); 00127 /* 00128 if ( uCanon[0] != uCanon2[0] || uPhases[0] != pPhases2[0] ) 00129 { 00130 int k = 0; 00131 Map_CanonCompute( p->nVarsMax, pCut->nLeaves, uTruth, &uCanon2, &pPhases2 ); 00132 } 00133 */ 00134 uCanon[0] = uCanon2[0]; 00135 uCanon[1] = (p->nVarsMax == 6)? uCanon2[1] : uCanon2[0]; 00136 uPhases[0] = pPhases2[0]; 00137 } 00138 else 00139 Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00140 pCut->M[1].pSupers = Map_SuperTableLookupC( p->pSuperLib, uCanon ); 00141 pCut->M[1].uPhase = uPhases[0]; 00142 p->nCanons++; 00143 00144 //uCanon1 = uCanon[0] & 0xFFFF; 00145 00146 // compute the canonical form for the negative phase 00147 uTruth[0] = ~uTruth[0]; 00148 uTruth[1] = ~uTruth[1]; 00149 if ( fUseFast ) 00150 Map_CanonComputeFast( p, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00151 else if ( fUseSlow ) 00152 Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00153 else if ( fUseRec ) 00154 { 00155 // Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00156 Extra_TruthCanonFastN( p->nVarsMax, pCut->nLeaves, uTruth, &uCanon2, &pPhases2 ); 00157 /* 00158 if ( uCanon[0] != uCanon2[0] || uPhases[0] != pPhases2[0] ) 00159 { 00160 int k = 0; 00161 Map_CanonCompute( p->nVarsMax, pCut->nLeaves, uTruth, &uCanon2, &pPhases2 ); 00162 } 00163 */ 00164 uCanon[0] = uCanon2[0]; 00165 uCanon[1] = (p->nVarsMax == 6)? uCanon2[1] : uCanon2[0]; 00166 uPhases[0] = pPhases2[0]; 00167 } 00168 else 00169 Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon ); 00170 pCut->M[0].pSupers = Map_SuperTableLookupC( p->pSuperLib, uCanon ); 00171 pCut->M[0].uPhase = uPhases[0]; 00172 p->nCanons++; 00173 00174 //uCanon2 = uCanon[0] & 0xFFFF; 00175 //assert( p->nVarsMax == 4 ); 00176 //Rwt_Man4ExploreCount( uCanon1 < uCanon2 ? uCanon1 : uCanon2 ); 00177 00178 // restore the truth table 00179 uTruth[0] = ~uTruth[0]; 00180 uTruth[1] = ~uTruth[1]; 00181 }
Function*************************************************************
Synopsis [Computes the truth table of one cut.]
Description []
SideEffects []
SeeAlso []
Definition at line 194 of file mapperTruth.c.
00195 { 00196 unsigned uTruth1[2], uTruth2[2]; 00197 Map_Cut_t * pTemp; 00198 int i; 00199 // mark the cut leaves 00200 for ( i = 0; i < pCut->nLeaves; i++ ) 00201 { 00202 pTemp = pCut->ppLeaves[i]->pCuts; 00203 pTemp->fMark = 1; 00204 pTemp->M[0].uPhaseBest = p->uTruths[i][0]; 00205 pTemp->M[1].uPhaseBest = p->uTruths[i][1]; 00206 } 00207 assert( pCut->fMark == 0 ); 00208 00209 // collect the cuts in the cut cone 00210 p->vVisited->nSize = 0; 00211 Map_CutsCollect_rec( pCut, p->vVisited ); 00212 assert( p->vVisited->nSize > 0 ); 00213 pCut->nVolume = p->vVisited->nSize; 00214 00215 // compute the tables and unmark 00216 for ( i = 0; i < pCut->nLeaves; i++ ) 00217 { 00218 pTemp = pCut->ppLeaves[i]->pCuts; 00219 pTemp->fMark = 0; 00220 } 00221 for ( i = 0; i < p->vVisited->nSize; i++ ) 00222 { 00223 // get the cut 00224 pTemp = (Map_Cut_t *)p->vVisited->pArray[i]; 00225 pTemp->fMark = 0; 00226 // get truth table of the first branch 00227 if ( Map_CutIsComplement(pTemp->pOne) ) 00228 { 00229 uTruth1[0] = ~Map_CutRegular(pTemp->pOne)->M[0].uPhaseBest; 00230 uTruth1[1] = ~Map_CutRegular(pTemp->pOne)->M[1].uPhaseBest; 00231 } 00232 else 00233 { 00234 uTruth1[0] = Map_CutRegular(pTemp->pOne)->M[0].uPhaseBest; 00235 uTruth1[1] = Map_CutRegular(pTemp->pOne)->M[1].uPhaseBest; 00236 } 00237 // get truth table of the second branch 00238 if ( Map_CutIsComplement(pTemp->pTwo) ) 00239 { 00240 uTruth2[0] = ~Map_CutRegular(pTemp->pTwo)->M[0].uPhaseBest; 00241 uTruth2[1] = ~Map_CutRegular(pTemp->pTwo)->M[1].uPhaseBest; 00242 } 00243 else 00244 { 00245 uTruth2[0] = Map_CutRegular(pTemp->pTwo)->M[0].uPhaseBest; 00246 uTruth2[1] = Map_CutRegular(pTemp->pTwo)->M[1].uPhaseBest; 00247 } 00248 // get the truth table of the output 00249 if ( !pTemp->Phase ) 00250 { 00251 pTemp->M[0].uPhaseBest = uTruth1[0] & uTruth2[0]; 00252 pTemp->M[1].uPhaseBest = uTruth1[1] & uTruth2[1]; 00253 } 00254 else 00255 { 00256 pTemp->M[0].uPhaseBest = ~(uTruth1[0] & uTruth2[0]); 00257 pTemp->M[1].uPhaseBest = ~(uTruth1[1] & uTruth2[1]); 00258 } 00259 } 00260 uTruth[0] = pTemp->M[0].uPhaseBest; 00261 uTruth[1] = pTemp->M[1].uPhaseBest; 00262 }