summaryrefslogtreecommitdiffstats
path: root/src/map
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2005-09-05 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2005-09-05 08:01:00 -0700
commit1260d20cc05fe2d21088cc047c460e85ccdb3b14 (patch)
treef10ccc3333f78b6e2e089a88c8cf61a47b2f2dcd /src/map
parent33012d9530c40817e1fc5230b3e663f7690b2e94 (diff)
downloadabc-1260d20cc05fe2d21088cc047c460e85ccdb3b14.tar.gz
abc-1260d20cc05fe2d21088cc047c460e85ccdb3b14.tar.bz2
abc-1260d20cc05fe2d21088cc047c460e85ccdb3b14.zip
Version abc50905
Diffstat (limited to 'src/map')
-rw-r--r--src/map/fpga/fpga.c10
-rw-r--r--src/map/fpga/fpgaCore.c2
-rw-r--r--src/map/fpga/fpgaSwitch.c39
-rw-r--r--src/map/fpga/fpgaUtils.c2
-rw-r--r--src/map/mapper/mapper.c8
-rw-r--r--src/map/mapper/mapperLib.c10
-rw-r--r--src/map/mapper/mapperRefs.c2
-rw-r--r--src/map/mapper/mapperSwitch.c38
-rw-r--r--src/map/mio/mio.c10
9 files changed, 35 insertions, 86 deletions
diff --git a/src/map/fpga/fpga.c b/src/map/fpga/fpga.c
index 6b107498..3d2ca913 100644
--- a/src/map/fpga/fpga.c
+++ b/src/map/fpga/fpga.c
@@ -56,9 +56,9 @@ static int Fpga_CommandPrintLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
void Fpga_Init( Abc_Frame_t * pAbc )
{
// set the default library
- //Fpga_LutLib_t s_LutLib = { "lutlib", 6, {0,1,2,4,8,16,32}, {0,1,2,3,4,5,6} };
- Fpga_LutLib_t s_LutLib = { "lutlib", 5, {0,1,1,1,1,1}, {0,1,1,1,1,1} };
- Abc_FrameSetLibLut( pAbc, Fpga_LutLibDup(&s_LutLib) );
+ //Fpga_LutLib_t s_LutLib = { "lutlib", 6, {0,1,2,4,8,16,32}, {0,1,2,3,4,5,6} };
+ Fpga_LutLib_t s_LutLib = { "lutlib", 5, {0,1,1,1,1,1}, {0,1,1,1,1,1} };
+ Abc_FrameSetLibLut( Fpga_LutLibDup(&s_LutLib) );
Cmd_CommandAdd( pAbc, "FPGA mapping", "read_lut", Fpga_CommandReadLibrary, 0 );
Cmd_CommandAdd( pAbc, "FPGA mapping", "print_lut", Fpga_CommandPrintLibrary, 0 );
@@ -150,8 +150,8 @@ int Fpga_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
goto usage;
}
// replace the current library
- Fpga_LutLibFree( Abc_FrameReadLibLut(Abc_FrameGetGlobalFrame()) );
- Abc_FrameSetLibLut( Abc_FrameGetGlobalFrame(), pLib );
+ Fpga_LutLibFree( Abc_FrameReadLibLut() );
+ Abc_FrameSetLibLut( pLib );
return 0;
usage:
diff --git a/src/map/fpga/fpgaCore.c b/src/map/fpga/fpgaCore.c
index 95b9ca49..9ca65379 100644
--- a/src/map/fpga/fpgaCore.c
+++ b/src/map/fpga/fpgaCore.c
@@ -97,7 +97,7 @@ int Fpga_Mapping( Fpga_Man_t * p )
***********************************************************************/
int Fpga_MappingPostProcess( Fpga_Man_t * p )
{
- int fShowSwitching = 0;
+ int fShowSwitching = 1;
int fRecoverAreaFlow = 1;
int fRecoverArea = 1;
float aAreaTotalCur, aAreaTotalCur2;
diff --git a/src/map/fpga/fpgaSwitch.c b/src/map/fpga/fpgaSwitch.c
index 0d2ec3fc..8cc77990 100644
--- a/src/map/fpga/fpgaSwitch.c
+++ b/src/map/fpga/fpgaSwitch.c
@@ -22,8 +22,6 @@
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
-static float Fpga_CutGetSwitching( Fpga_Cut_t * pCut );
-
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFITIONS ///
////////////////////////////////////////////////////////////////////////
@@ -64,10 +62,10 @@ float Fpga_CutRefSwitch( Fpga_Man_t * pMan, Fpga_Node_t * pNode, Fpga_Cut_t * pC
Fpga_Node_t * pNodeChild;
float aArea;
int i;
- if ( pCut->nLeaves == 1 )
- return 0;
// start the area of this cut
- aArea = Fpga_CutGetSwitching( pCut );
+ aArea = pNode->Switching;
+ if ( pCut->nLeaves == 1 )
+ return aArea;
// go through the children
for ( i = 0; i < pCut->nLeaves; i++ )
{
@@ -96,10 +94,10 @@ float Fpga_CutDerefSwitch( Fpga_Man_t * pMan, Fpga_Node_t * pNode, Fpga_Cut_t *
Fpga_Node_t * pNodeChild;
float aArea;
int i;
- if ( pCut->nLeaves == 1 )
- return 0;
// start the area of this cut
- aArea = Fpga_CutGetSwitching( pCut );
+ aArea = pNode->Switching;
+ if ( pCut->nLeaves == 1 )
+ return aArea;
// go through the children
for ( i = 0; i < pCut->nLeaves; i++ )
{
@@ -112,27 +110,6 @@ float Fpga_CutDerefSwitch( Fpga_Man_t * pMan, Fpga_Node_t * pNode, Fpga_Cut_t *
return aArea;
}
-/**function*************************************************************
-
- synopsis [Computes the exact area associated with the cut.]
-
- description []
-
- sideeffects []
-
- seealso []
-
-***********************************************************************/
-float Fpga_CutGetSwitching( Fpga_Cut_t * pCut )
-{
- float Result;
- int i;
- Result = 0.0;
- for ( i = 0; i < pCut->nLeaves; i++ )
- Result += pCut->ppLeaves[i]->Switching;
- return Result;
-}
-
/**Function*************************************************************
Synopsis [Computes the array of mapping.]
@@ -153,10 +130,8 @@ float Fpga_MappingGetSwitching( Fpga_Man_t * pMan, Fpga_NodeVec_t * vMapping )
for ( i = 0; i < vMapping->nSize; i++ )
{
pNode = vMapping->pArray[i];
- if ( !Fpga_NodeIsAnd(pNode) )
- continue;
// at least one phase has the best cut assigned
- assert( pNode->pCutBest != NULL );
+ assert( !Fpga_NodeIsAnd(pNode) || pNode->pCutBest != NULL );
// at least one phase is used in the mapping
assert( pNode->nRefs > 0 );
// compute the array due to the supergate
diff --git a/src/map/fpga/fpgaUtils.c b/src/map/fpga/fpgaUtils.c
index 3ea1f2f1..db0f9623 100644
--- a/src/map/fpga/fpgaUtils.c
+++ b/src/map/fpga/fpgaUtils.c
@@ -314,7 +314,7 @@ float Fpga_MappingSetRefsAndArea( Fpga_Man_t * pMan )
// reconnect the nodes in reverse topological order
pMan->vMapping->nSize = 0;
- for ( i = LevelMax; i > 0; i-- )
+ for ( i = LevelMax; i >= 0; i-- )
for ( pNode = ppStore[i]; pNode; pNode = (Fpga_Node_t *)pNode->pData0 )
Fpga_NodeVecPush( pMan->vMapping, pNode );
free( ppStore );
diff --git a/src/map/mapper/mapper.c b/src/map/mapper/mapper.c
index 546186a2..e59fa4a3 100644
--- a/src/map/mapper/mapper.c
+++ b/src/map/mapper/mapper.c
@@ -149,13 +149,13 @@ int Map_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
// replace the current library
// Map_SuperLibFree( s_pSuperLib );
// s_pSuperLib = pLib;
- Map_SuperLibFree( Abc_FrameReadLibSuper(Abc_FrameGetGlobalFrame()) );
- Abc_FrameSetLibSuper( Abc_FrameGetGlobalFrame(), pLib );
+ Map_SuperLibFree( Abc_FrameReadLibSuper() );
+ Abc_FrameSetLibSuper( pLib );
// replace the current genlib library
// if ( s_pLib ) Mio_LibraryDelete( s_pLib );
// s_pLib = s_pSuperLib->pGenlib;
- Mio_LibraryDelete( Abc_FrameReadLibGen(Abc_FrameGetGlobalFrame()) );
- Abc_FrameSetLibGen( Abc_FrameGetGlobalFrame(), pLib->pGenlib );
+ Mio_LibraryDelete( Abc_FrameReadLibGen() );
+ Abc_FrameSetLibGen( pLib->pGenlib );
return 0;
usage:
diff --git a/src/map/mapper/mapperLib.c b/src/map/mapper/mapperLib.c
index 5fea1f00..a9e9e29b 100644
--- a/src/map/mapper/mapperLib.c
+++ b/src/map/mapper/mapperLib.c
@@ -139,15 +139,9 @@ void Map_SuperLibFree( Map_SuperLib_t * p )
if ( p == NULL ) return;
if ( p->pGenlib )
{
-// if ( s_pLib == p->pGenlib )
-// s_pLib = NULL;
-// if ( Abc_FrameReadLibGen(Abc_FrameGetGlobalFrame()) == p->pGenlib )
-// Abc_FrameSetLibGen(Abc_FrameGetGlobalFrame(), NULL);
-// Mio_LibraryDelete( p->pGenlib );
-
- assert( p->pGenlib == Abc_FrameReadLibGen(Abc_FrameGetGlobalFrame()) );
+ assert( p->pGenlib == Abc_FrameReadLibGen() );
Mio_LibraryDelete( p->pGenlib );
- Abc_FrameSetLibGen(Abc_FrameGetGlobalFrame(), NULL);
+ Abc_FrameSetLibGen( NULL );
}
if ( p->tTableC )
Map_SuperTableFree( p->tTableC );
diff --git a/src/map/mapper/mapperRefs.c b/src/map/mapper/mapperRefs.c
index e4adadae..baaebfa1 100644
--- a/src/map/mapper/mapperRefs.c
+++ b/src/map/mapper/mapperRefs.c
@@ -542,7 +542,7 @@ float Map_MappingGetArea( Map_Man_t * pMan, Map_NodeVec_t * vMapping )
(pNode->pCutBest[1] == NULL && pNode->nRefAct[1] > 0) )
Area += pMan->pSuperLib->AreaInv;
}
- // add buffer for each CO driven by a CI
+ // add buffers for each CO driven by a CI
for ( i = 0; i < pMan->nOutputs; i++ )
if ( Map_NodeIsVar(pMan->pOutputs[i]) && !Map_IsComplement(pMan->pOutputs[i]) )
Area += pMan->pSuperLib->AreaBuf;
diff --git a/src/map/mapper/mapperSwitch.c b/src/map/mapper/mapperSwitch.c
index 02f38396..13168b47 100644
--- a/src/map/mapper/mapperSwitch.c
+++ b/src/map/mapper/mapperSwitch.c
@@ -23,7 +23,6 @@
////////////////////////////////////////////////////////////////////////
static float Map_SwitchCutRefDeref( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhase, int fReference );
-static float Map_CutGetSwitching( Map_Cut_t * pCut );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFITIONS ///
@@ -100,11 +99,13 @@ float Map_SwitchCutRefDeref( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhase, i
Map_Cut_t * pCutChild;
float aSwitchActivity;
int i, fPhaseChild;
+
+ // start switching activity for the node
+ aSwitchActivity = pNode->Switching;
// consider the elementary variable
if ( pCut->nLeaves == 1 )
- return 0;
- // start the area of this cut
- aSwitchActivity = Map_CutGetSwitching( pCut );
+ return aSwitchActivity;
+
// go through the children
assert( pCut->M[fPhase].pSuperBest );
for ( i = 0; i < pCut->nLeaves; i++ )
@@ -127,7 +128,7 @@ float Map_SwitchCutRefDeref( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhase, i
// inverter should be added if the phase
// (a) has no reference and (b) is implemented using other phase
if ( pNodeChild->nRefAct[fPhaseChild]++ == 0 && pNodeChild->pCutBest[fPhaseChild] == NULL )
- aSwitchActivity += pNodeChild->Switching;
+ aSwitchActivity += pNodeChild->Switching; // inverter switches the same as the node
// if the node is referenced, there is no recursive call
if ( pNodeChild->nRefAct[2]++ > 0 )
continue;
@@ -147,7 +148,7 @@ float Map_SwitchCutRefDeref( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhase, i
// inverter should be added if the phase
// (a) has no reference and (b) is implemented using other phase
if ( --pNodeChild->nRefAct[fPhaseChild] == 0 && pNodeChild->pCutBest[fPhaseChild] == NULL )
- aSwitchActivity += pNodeChild->Switching;
+ aSwitchActivity += pNodeChild->Switching; // inverter switches the same as the node
// if the node is referenced, there is no recursive call
if ( --pNodeChild->nRefAct[2] > 0 )
continue;
@@ -169,27 +170,6 @@ float Map_SwitchCutRefDeref( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhase, i
return aSwitchActivity;
}
-/**function*************************************************************
-
- synopsis [Computes the exact area associated with the cut.]
-
- description []
-
- sideeffects []
-
- seealso []
-
-***********************************************************************/
-float Map_CutGetSwitching( Map_Cut_t * pCut )
-{
- float Result;
- int i;
- Result = 0.0;
- for ( i = 0; i < pCut->nLeaves; i++ )
- Result += pCut->ppLeaves[i]->Switching;
- return Result;
-}
-
/**Function*************************************************************
Synopsis [Computes the array of mapping.]
@@ -227,9 +207,9 @@ float Map_MappingGetSwitching( Map_Man_t * pMan, Map_NodeVec_t * vMapping )
// count switching of the interver if we need to implement one phase with another phase
if ( (pNode->pCutBest[0] == NULL && pNode->nRefAct[0] > 0) ||
(pNode->pCutBest[1] == NULL && pNode->nRefAct[1] > 0) )
- Switch += pNode->Switching;
+ Switch += pNode->Switching; // inverter switches the same as the node
}
- // add buffer for each CO driven by a CI
+ // add buffers for each CO driven by a CI
for ( i = 0; i < pMan->nOutputs; i++ )
if ( Map_NodeIsVar(pMan->pOutputs[i]) && !Map_IsComplement(pMan->pOutputs[i]) )
Switch += pMan->pOutputs[i]->Switching;
diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c
index a01aeaa9..bb6dbba1 100644
--- a/src/map/mio/mio.c
+++ b/src/map/mio/mio.c
@@ -83,7 +83,7 @@ void Mio_Init( Abc_Frame_t * pAbc )
fclose( pFile );
// read genlib from file
pLibGen = Mio_LibraryRead( pAbc, pFileTemp, NULL, 0 );
- Abc_FrameSetLibGen( pAbc, pLibGen );
+ Abc_FrameSetLibGen( pLibGen );
#ifdef WIN32
_unlink( pFileTemp );
#else
@@ -186,15 +186,15 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
extern void Map_SuperLibFree( Map_SuperLib_t * p );
// Map_SuperLibFree( s_pSuperLib );
// s_pSuperLib = NULL;
- Map_SuperLibFree( Abc_FrameReadLibSuper(Abc_FrameGetGlobalFrame()) );
- Abc_FrameSetLibSuper(Abc_FrameGetGlobalFrame(), NULL);
+ Map_SuperLibFree( Abc_FrameReadLibSuper() );
+ Abc_FrameSetLibSuper( NULL );
}
// replace the current library
// Mio_LibraryDelete( s_pLib );
// s_pLib = pLib;
- Mio_LibraryDelete( Abc_FrameReadLibGen(Abc_FrameGetGlobalFrame()) );
- Abc_FrameSetLibGen( Abc_FrameGetGlobalFrame(), pLib );
+ Mio_LibraryDelete( Abc_FrameReadLibGen() );
+ Abc_FrameSetLibGen( pLib );
return 0;
usage: