summaryrefslogtreecommitdiffstats
path: root/src/base/wlc
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2018-11-18 21:01:30 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2018-11-18 21:01:30 -0800
commit12908d3c25254e938737c4f1dd94074e2a1e98ff (patch)
treef97cda31905d33c681dace42bfbd09499787ad76 /src/base/wlc
parent33159929201bcf8f2f6ae2e573176f948b8cb865 (diff)
downloadabc-12908d3c25254e938737c4f1dd94074e2a1e98ff.tar.gz
abc-12908d3c25254e938737c4f1dd94074e2a1e98ff.tar.bz2
abc-12908d3c25254e938737c4f1dd94074e2a1e98ff.zip
Various usability changes.
Diffstat (limited to 'src/base/wlc')
-rw-r--r--src/base/wlc/wlcAbc.c52
-rw-r--r--src/base/wlc/wlcBlast.c2
-rw-r--r--src/base/wlc/wlcCom.c13
-rw-r--r--src/base/wlc/wlcReadVer.c57
4 files changed, 119 insertions, 5 deletions
diff --git a/src/base/wlc/wlcAbc.c b/src/base/wlc/wlcAbc.c
index 1836f4ed..e1b06ffd 100644
--- a/src/base/wlc/wlcAbc.c
+++ b/src/base/wlc/wlcAbc.c
@@ -42,6 +42,58 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
+void Wlc_NtkPrintInputInfo( Wlc_Ntk_t * pNtk )
+{
+ Wlc_Obj_t * pObj;
+ int i, k, nRange, nBeg, nEnd, nBits = 0;
+ FILE * output;
+
+ output = fopen("abc_blast_input.info","w");
+
+ Wlc_NtkForEachCi( pNtk, pObj, i )
+ {
+ nRange = Wlc_ObjRange(pObj);
+ nBeg = pObj->Beg;
+ nEnd = pObj->End;
+
+ for ( k = 0; k < nRange; k++ )
+ {
+ int index = nEnd > nBeg ? nBeg + k : nEnd + k;
+ char c = pObj->Type != WLC_OBJ_FO ? 'i' : pNtk->pInits[nBits + k];
+ fprintf(output,"%s[%d] : %c \n", Wlc_ObjName(pNtk, Wlc_ObjId(pNtk, pObj)), index , c );
+ }
+ if (pObj->Type == WLC_OBJ_FO)
+ nBits += nRange;
+ }
+
+ Wlc_NtkForEachPo( pNtk, pObj, i )
+ {
+ nRange = Wlc_ObjRange(pObj);
+ nBeg = pObj->Beg;
+ nEnd = pObj->End;
+
+ for ( k = 0; k < nRange; k++ )
+ {
+ int index = nEnd > nBeg ? nBeg + k : nEnd + k;
+ fprintf(output,"%s[%d] : o \n", Wlc_ObjName(pNtk, Wlc_ObjId(pNtk, pObj)), index);
+ }
+ }
+
+ fclose(output);
+ return;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
void Wlc_NtkPrintInvStats( Wlc_Ntk_t * pNtk, Vec_Int_t * vCounts, int fVerbose )
{
Wlc_Obj_t * pObj;
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c
index 32fdc703..4b59379b 100644
--- a/src/base/wlc/wlcBlast.c
+++ b/src/base/wlc/wlcBlast.c
@@ -173,7 +173,7 @@ void Wlc_BlastShiftRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift,
int nShiftMax = Abc_Base2Log(nNum);
int * pShiftNew = ABC_ALLOC( int, nShift );
memcpy( pShiftNew, pShift, sizeof(int)*nShift );
- if ( nShiftMax < nShift )
+ if ( nShiftMax < nShift && nShift > 30 )
{
int i, iRes = pShiftNew[nShiftMax];
for ( i = nShiftMax + 1; i < nShift; i++ )
diff --git a/src/base/wlc/wlcCom.c b/src/base/wlc/wlcCom.c
index 5b99cb00..6df2c840 100644
--- a/src/base/wlc/wlcCom.c
+++ b/src/base/wlc/wlcCom.c
@@ -970,13 +970,14 @@ usage:
******************************************************************************/
int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
{
+ extern void Wlc_NtkPrintInputInfo( Wlc_Ntk_t * pNtk );
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
- Gia_Man_t * pNew = NULL; int c, fMiter = 0, fDumpNames = 0;
+ Gia_Man_t * pNew = NULL; int c, fMiter = 0, fDumpNames = 0, fPrintInputInfo = 0;
Wlc_BstPar_t Par, * pPar = &Par;
Wlc_BstParDefault( pPar );
pPar->nOutputRange = 2;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "ORAMcombadstnvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "ORAMcombadstnivh" ) ) != EOF )
{
switch ( c )
{
@@ -1052,6 +1053,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'n':
fDumpNames ^= 1;
break;
+ case 'i':
+ fPrintInputInfo ^= 1;
+ break;
case 'v':
pPar->fVerbose ^= 1;
break;
@@ -1066,6 +1070,8 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Abc_CommandBlast(): There is no current design.\n" );
return 0;
}
+ if ( fPrintInputInfo )
+ Wlc_NtkPrintInputInfo(pNtk);
if ( pPar->fMulti )
{
pPar->vBoxIds = Wlc_NtkCollectMultipliers( pNtk );
@@ -1118,7 +1124,7 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_FrameUpdateGia( pAbc, pNew );
return 0;
usage:
- Abc_Print( -2, "usage: %%blast [-ORAM num] [-combadstnvh]\n" );
+ Abc_Print( -2, "usage: %%blast [-ORAM num] [-combadstnivh]\n" );
Abc_Print( -2, "\t performs bit-blasting of the word-level design\n" );
Abc_Print( -2, "\t-O num : zero-based index of the first word-level PO to bit-blast [default = %d]\n", pPar->iOutput );
Abc_Print( -2, "\t-R num : the total number of word-level POs to bit-blast [default = %d]\n", pPar->nOutputRange );
@@ -1133,6 +1139,7 @@ usage:
Abc_Print( -2, "\t-s : toggle creating decoded MUXes [default = %s]\n", pPar->fDecMuxes? "yes": "no" );
Abc_Print( -2, "\t-t : toggle creating regular multi-output miter [default = %s]\n", fMiter? "yes": "no" );
Abc_Print( -2, "\t-n : toggle dumping signal names into a text file [default = %s]\n", fDumpNames? "yes": "no" );
+ Abc_Print( -2, "\t-i : toggle to print input names after blasting [default = %s]\n", fPrintInputInfo ? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPar->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
diff --git a/src/base/wlc/wlcReadVer.c b/src/base/wlc/wlcReadVer.c
index 34966777..42332819 100644
--- a/src/base/wlc/wlcReadVer.c
+++ b/src/base/wlc/wlcReadVer.c
@@ -1203,7 +1203,13 @@ startword:
break;
}
// check range of the control
- if ( nValues != Vec_IntSize(p->vFanins) - 1 )
+ if ( nValues < Vec_IntSize(p->vFanins) - 1 ) // may occur if default is not there
+ {
+ //return Wlc_PrsWriteErrorMessage( p, pStart, "The number of values in the case statement is wrong.", pName );
+ printf( "Warning: The number of values in the case statement is wrong.\n" );
+ Vec_IntShrink(p->vFanins,nValues+1);
+ }
+ else if ( nValues > Vec_IntSize(p->vFanins) - 1 )
return Wlc_PrsWriteErrorMessage( p, pStart, "The number of values in the case statement is wrong.", pName );
if ( Wlc_ObjRange(pObj) == 1 )
{
@@ -1526,6 +1532,55 @@ startword:
Wlc_ObjAddFanins( p->pNtk, pObj, p->vFanins );
p->pNtk->fMemPorts = 1;
}
+ else if ( Wlc_PrsStrCmp( pStart, "CPL_RROT" ) || Wlc_PrsStrCmp( pStart, "CPL_LROT" ) )
+ {
+ // CPL_RROT #(128, 6) I_47479(.o ( E_46713 ) , .d ( E_46718 ) , .s ( E_46712 ) );
+ int right_rotation = Wlc_PrsStrCmp( pStart, "CPL_RROT" );
+ int NameId = -1, NameIdOut = -1, NameIdInD = -1, NameIdInS = -1, fFound, fRotInD, fRotInS, fRotOut;
+ pStart += strlen("CPL_RROT");
+
+ // NOTE: no need to parse the parameter values
+ //if ( pStart[0] == '#' )
+
+ // read names
+ while ( 1 )
+ {
+ pStart = Wlc_PrsFindSymbol( pStart, '.' );
+ if ( pStart == NULL )
+ break;
+ pStart = Wlc_PrsSkipSpaces( pStart+1 );
+ if ( pStart[0] != 'o' && pStart[0] != 'd' && pStart[0] != 's')
+ continue;
+ fRotInD = (pStart[0] == 'd');
+ fRotInS = (pStart[0] == 's');
+ fRotOut = (pStart[0] == 'o');
+ pStart = Wlc_PrsFindSymbol( pStart, '(' );
+ if ( pStart == NULL )
+ return Wlc_PrsWriteErrorMessage( p, pStart, "Cannot read opening parenthesis in the rotation description." );
+ pStart = Wlc_PrsFindName( pStart+1, &pName );
+ if ( pStart == NULL )
+ return Wlc_PrsWriteErrorMessage( p, pStart, "Cannot read name inside rotation description." );
+ if ( fRotInD )
+ NameIdInD = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
+ else if ( fRotInS )
+ NameIdInS = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
+ else if ( fRotOut )
+ NameIdOut = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
+ else
+ NameId = Abc_NamStrFindOrAdd( p->pNtk->pManName, pName, &fFound );
+ if ( !fFound )
+ return Wlc_PrsWriteErrorMessage( p, pStart, "Name %s is not declared.", pName );
+ }
+ if ( NameIdOut == -1 || NameIdInD == -1 || NameIdInS == -1 )
+ return Wlc_PrsWriteErrorMessage( p, pStart, "Some fields of CPL_ROT are missing." );
+ // create rot output
+ pObj = Wlc_NtkObj( p->pNtk, NameIdOut );
+ Wlc_ObjUpdateType( p->pNtk, pObj, right_rotation ? WLC_OBJ_ROTATE_R : WLC_OBJ_ROTATE_L );
+ Vec_IntClear( p->vFanins );
+ Vec_IntPush( p->vFanins, NameIdInD );
+ Vec_IntPush( p->vFanins, NameIdInS );
+ Wlc_ObjAddFanins( p->pNtk, pObj, p->vFanins );
+ }
else if ( pStart[0] == '(' && pStart[1] == '*' ) // skip comments
{
while ( *pStart++ != ')' );