Commit 2becb24a by Alan Mishchenko

Bug fixes having to do with the use of chars.

parent e2842bea
...@@ -4548,9 +4548,9 @@ void Cnf_ReadMsops( char ** ppSopSizes, char *** ppSops ) ...@@ -4548,9 +4548,9 @@ void Cnf_ReadMsops( char ** ppSopSizes, char *** ppSops )
// map chars into their numbers // map chars into their numbers
for ( i = 0; i < 256; i++ ) for ( i = 0; i < 256; i++ )
Map[i] = -1; Map[i] = (char)(-1);
for ( i = 0; i < 81; i++ ) for ( i = 0; i < 81; i++ )
Map[(int)s_Data3[i]] = i; Map[(int)s_Data3[i]] = (char)i;
// count the number of strings // count the number of strings
for ( Size = 0; s_Data4[Size] && Size < 100000; Size++ ); for ( Size = 0; s_Data4[Size] && Size < 100000; Size++ );
...@@ -4562,7 +4562,7 @@ void Cnf_ReadMsops( char ** ppSopSizes, char *** ppSops ) ...@@ -4562,7 +4562,7 @@ void Cnf_ReadMsops( char ** ppSopSizes, char *** ppSops )
for ( i = 0; i < Size; i++ ) for ( i = 0; i < Size; i++ )
for ( k = 0; k < 75; k++ ) for ( k = 0; k < 75; k++ )
if ( s_Data4[i][k] == ' ' ) if ( s_Data4[i][k] == ' ' )
pMemory[i*75+k] = -1; pMemory[i*75+k] = (char)(-1);
else else
pMemory[i*75+k] = Map[(int)s_Data4[i][k]]; pMemory[i*75+k] = Map[(int)s_Data4[i][k]];
...@@ -4573,7 +4573,7 @@ void Cnf_ReadMsops( char ** ppSopSizes, char *** ppSops ) ...@@ -4573,7 +4573,7 @@ void Cnf_ReadMsops( char ** ppSopSizes, char *** ppSops )
pSops[0] = NULL; pSops[0] = NULL;
pPrev = pMemory; pPrev = pMemory;
for ( k = 0, i = 1; i < 65536; k++ ) for ( k = 0, i = 1; i < 65536; k++ )
if ( pMemory[k] == -1 ) if ( pMemory[k] == (char)(-1) )
{ {
pSopSizes[i] = pMemory + k - pPrev; pSopSizes[i] = pMemory + k - pPrev;
pSops[i++] = pPrev; pSops[i++] = pPrev;
......
...@@ -8539,6 +8539,14 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -8539,6 +8539,14 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
} }
*/ */
/*
{
extern void Ssm_ManExperiment( char * pFileIn, char * pFileOut );
// Ssm_ManExperiment( "m\\big2.ssim", "m\\big2_.ssim" );
// Ssm_ManExperiment( "m\\big3.ssim", "m\\big3_.ssim" );
Ssm_ManExperiment( "m\\tb.ssim", "m\\tb_.ssim" );
}
*/
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: test [-CKDN] [-vwh] <file_name>\n" ); Abc_Print( -2, "usage: test [-CKDN] [-vwh] <file_name>\n" );
......
...@@ -28,6 +28,8 @@ ABC_NAMESPACE_IMPL_START ...@@ -28,6 +28,8 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
#define IF_BIG_CHAR 120
static void If_CutSortInputPins( If_Man_t * p, If_Cut_t * pCut, int * pPinPerm, float * pPinDelays ); static void If_CutSortInputPins( If_Man_t * p, If_Cut_t * pCut, int * pPinPerm, float * pPinDelays );
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -307,11 +309,11 @@ int If_CutDelayLeafDepth_rec( Vec_Wrd_t * vAnds, If_And_t And, int iLeaf ) ...@@ -307,11 +309,11 @@ int If_CutDelayLeafDepth_rec( Vec_Wrd_t * vAnds, If_And_t And, int iLeaf )
if ( (int)And.Id == iLeaf ) if ( (int)And.Id == iLeaf )
return 0; return 0;
if ( And.iFan0 == And.iFan1 ) if ( And.iFan0 == And.iFan1 )
return -100; return -IF_BIG_CHAR;
Depth0 = If_CutDelayLeafDepth_rec( vAnds, If_WrdToAnd(Vec_WrdEntry(vAnds, And.iFan0)), iLeaf ); Depth0 = If_CutDelayLeafDepth_rec( vAnds, If_WrdToAnd(Vec_WrdEntry(vAnds, And.iFan0)), iLeaf );
Depth1 = If_CutDelayLeafDepth_rec( vAnds, If_WrdToAnd(Vec_WrdEntry(vAnds, And.iFan1)), iLeaf ); Depth1 = If_CutDelayLeafDepth_rec( vAnds, If_WrdToAnd(Vec_WrdEntry(vAnds, And.iFan1)), iLeaf );
Depth = ABC_MAX( Depth0, Depth1 ); Depth = ABC_MAX( Depth0, Depth1 );
Depth = (Depth == -100) ? -100 : Depth + 1; Depth = (Depth == -IF_BIG_CHAR) ? -IF_BIG_CHAR : Depth + 1;
return Depth; return Depth;
} }
...@@ -330,15 +332,15 @@ int If_CutDelayLeafDepth( Vec_Wrd_t * vAnds, int iLeaf ) ...@@ -330,15 +332,15 @@ int If_CutDelayLeafDepth( Vec_Wrd_t * vAnds, int iLeaf )
{ {
If_And_t Leaf; If_And_t Leaf;
if ( Vec_WrdSize(vAnds) == 0 ) // const 0 if ( Vec_WrdSize(vAnds) == 0 ) // const 0
return -100; return -IF_BIG_CHAR;
if ( Vec_WrdSize(vAnds) == 1 && Vec_WrdEntry(vAnds, 0) == 0 ) // const 1 if ( Vec_WrdSize(vAnds) == 1 && Vec_WrdEntry(vAnds, 0) == 0 ) // const 1
return -100; return -IF_BIG_CHAR;
Leaf = If_WrdToAnd(Vec_WrdEntryLast(vAnds)); Leaf = If_WrdToAnd(Vec_WrdEntryLast(vAnds));
if ( Leaf.iFan0 == Leaf.iFan1 ) if ( Leaf.iFan0 == Leaf.iFan1 )
{ {
if ( (int)Leaf.iFan0 == iLeaf ) if ( (int)Leaf.iFan0 == iLeaf )
return 0; return 0;
return -100; return -IF_BIG_CHAR;
} }
return If_CutDelayLeafDepth_rec( vAnds, Leaf, iLeaf ); return If_CutDelayLeafDepth_rec( vAnds, Leaf, iLeaf );
} }
...@@ -359,7 +361,7 @@ int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut ) ...@@ -359,7 +361,7 @@ int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut )
{ {
If_And_t Leaf; If_And_t Leaf;
Vec_Wrd_t * vAnds; Vec_Wrd_t * vAnds;
int i;//, Delay; int i, Delay;
// mark cut as a user cut // mark cut as a user cut
pCut->fUser = 1; pCut->fUser = 1;
vAnds = If_CutDelaySopArray( p, pCut ); vAnds = If_CutDelaySopArray( p, pCut );
...@@ -378,8 +380,11 @@ int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut ) ...@@ -378,8 +380,11 @@ int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut )
pCut->Cost = 1; pCut->Cost = 1;
// get the permutation // get the permutation
for ( i = 0; i < (int)pCut->nLeaves; i++ ) for ( i = 0; i < (int)pCut->nLeaves; i++ )
pCut->pPerm[i] = If_CutDelayLeafDepth( vAnds, i ); {
Vec_WrdFree( vAnds ); Delay = If_CutDelayLeafDepth( vAnds, i );
pCut->pPerm[i] = (char)(Delay == -IF_BIG_CHAR ? IF_BIG_CHAR : Delay);
}
// Vec_WrdFree( vAnds );
// verify the delay // verify the delay
// Delay = If_CutDelay( p, pCut ); // Delay = If_CutDelay( p, pCut );
// assert( (int)Leaf.Delay == Delay ); // assert( (int)Leaf.Delay == Delay );
...@@ -409,7 +414,7 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ) ...@@ -409,7 +414,7 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut )
If_Obj_t * pLeaf; If_Obj_t * pLeaf;
float Delay, DelayCur; float Delay, DelayCur;
float * pLutDelays; float * pLutDelays;
int i, Shift; int i, Shift, Pin2PinDelay;
assert( p->pPars->fSeqMap || pCut->nLeaves > 1 ); assert( p->pPars->fSeqMap || pCut->nLeaves > 1 );
Delay = -IF_FLOAT_LARGE; Delay = -IF_FLOAT_LARGE;
if ( p->pPars->pLutLib ) if ( p->pPars->pLutLib )
...@@ -442,7 +447,8 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ) ...@@ -442,7 +447,8 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut )
assert( !p->pPars->fLiftLeaves ); assert( !p->pPars->fLiftLeaves );
If_CutForEachLeaf( p, pCut, pLeaf, i ) If_CutForEachLeaf( p, pCut, pLeaf, i )
{ {
DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)(pCut->pPerm ? pCut->pPerm[i] : 1.0); Pin2PinDelay = pCut->pPerm ? (pCut->pPerm[i] == IF_BIG_CHAR ? -IF_BIG_CHAR : pCut->pPerm[i]) : 1;
DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)Pin2PinDelay;
Delay = IF_MAX( Delay, DelayCur ); Delay = IF_MAX( Delay, DelayCur );
} }
} }
...@@ -488,7 +494,7 @@ void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float ObjRequired ) ...@@ -488,7 +494,7 @@ void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float ObjRequired )
If_Obj_t * pLeaf; If_Obj_t * pLeaf;
float * pLutDelays; float * pLutDelays;
float Required; float Required;
int i; int i, Pin2PinDelay;
assert( !p->pPars->fLiftLeaves ); assert( !p->pPars->fLiftLeaves );
// compute the pins // compute the pins
if ( p->pPars->pLutLib ) if ( p->pPars->pLutLib )
...@@ -518,7 +524,8 @@ void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float ObjRequired ) ...@@ -518,7 +524,8 @@ void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float ObjRequired )
{ {
If_CutForEachLeaf( p, pCut, pLeaf, i ) If_CutForEachLeaf( p, pCut, pLeaf, i )
{ {
Required = ObjRequired - (float)(pCut->pPerm ? pCut->pPerm[i] : 1.0); Pin2PinDelay = pCut->pPerm ? (pCut->pPerm[i] == IF_BIG_CHAR ? -IF_BIG_CHAR : pCut->pPerm[i]) : 1;
Required = ObjRequired - (float)Pin2PinDelay;
pLeaf->Required = IF_MIN( pLeaf->Required, Required ); pLeaf->Required = IF_MIN( pLeaf->Required, Required );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment