abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
scl.c File Reference
#include "sclSize.h"
#include "base/main/mainInt.h"

Go to the source code of this file.

Functions

static ABC_NAMESPACE_IMPL_START int Scl_CommandReadLib (Abc_Frame_t *pAbc, int argc, char **argv)
 DECLARATIONS ///. More...
 
static int Scl_CommandWriteLib (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandReadScl (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandWriteScl (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandPrintLib (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandLeak2Area (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandDumpGen (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandPrintGS (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandStime (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandTopo (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandUnBuffer (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandBuffer (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandBufferOld (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandMinsize (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandMaxsize (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandUpsize (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandDnsize (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandPrintBuf (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandReadConstr (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandPrintConstr (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Scl_CommandResetConstr (Abc_Frame_t *pAbc, int argc, char **argv)
 
void Abc_SclLoad (SC_Lib *pLib, SC_Lib **ppScl)
 FUNCTION DEFINITIONS ///. More...
 
void Scl_Init (Abc_Frame_t *pAbc)
 
void Scl_End (Abc_Frame_t *pAbc)
 

Function Documentation

void Abc_SclLoad ( SC_Lib pLib,
SC_Lib **  ppScl 
)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Updating library in the frameframe.]

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file scl.c.

69 {
70  if ( *ppScl )
71  {
72  Abc_SclLibFree( *ppScl );
73  *ppScl = NULL;
74  }
75  assert( *ppScl == NULL );
76  if ( pLib )
77  *(SC_Lib **)ppScl = pLib;
78 }
#define assert(ex)
Definition: util_old.h:213
static void Abc_SclLibFree(SC_Lib *p)
Definition: sclLib.h:443
int Scl_CommandBuffer ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 941 of file scl.c.

942 {
943  SC_BusPars Pars, * pPars = &Pars;
944  Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc);
945  int c;
946  memset( pPars, 0, sizeof(SC_BusPars) );
947  pPars->GainRatio = 300;
948  pPars->Slew = pAbc->pLibScl ? Abc_SclComputeAverageSlew((SC_Lib *)pAbc->pLibScl) : 100;
949  pPars->nDegree = 10;
950  pPars->fSizeOnly = 0;
951  pPars->fAddBufs = 1;
952  pPars->fBufPis = 0;
953  pPars->fUseWireLoads = 1;
954  pPars->fVerbose = 0;
955  pPars->fVeryVerbose = 0;
957  while ( ( c = Extra_UtilGetopt( argc, argv, "GSNsbpcvwh" ) ) != EOF )
958  {
959  switch ( c )
960  {
961  case 'G':
962  if ( globalUtilOptind >= argc )
963  {
964  Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" );
965  goto usage;
966  }
967  pPars->GainRatio = atoi(argv[globalUtilOptind]);
969  if ( pPars->GainRatio < 0 )
970  goto usage;
971  break;
972  case 'S':
973  if ( globalUtilOptind >= argc )
974  {
975  Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" );
976  goto usage;
977  }
978  pPars->Slew = atoi(argv[globalUtilOptind]);
980  if ( pPars->Slew < 0 )
981  goto usage;
982  break;
983  case 'N':
984  if ( globalUtilOptind >= argc )
985  {
986  Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
987  goto usage;
988  }
989  pPars->nDegree = atoi(argv[globalUtilOptind]);
991  if ( pPars->nDegree < 0 )
992  goto usage;
993  break;
994  case 's':
995  pPars->fSizeOnly ^= 1;
996  break;
997  case 'b':
998  pPars->fAddBufs ^= 1;
999  break;
1000  case 'p':
1001  pPars->fBufPis ^= 1;
1002  break;
1003  case 'c':
1004  pPars->fUseWireLoads ^= 1;
1005  break;
1006  case 'v':
1007  pPars->fVerbose ^= 1;
1008  break;
1009  case 'w':
1010  pPars->fVeryVerbose ^= 1;
1011  break;
1012  case 'h':
1013  goto usage;
1014  default:
1015  goto usage;
1016  }
1017  }
1018 
1019  if ( pNtk == NULL )
1020  {
1021  Abc_Print( -1, "Empty network.\n" );
1022  return 1;
1023  }
1024  if ( !Abc_NtkIsLogic(pNtk) )
1025  {
1026  Abc_Print( -1, "This command can only be applied to a logic network.\n" );
1027  return 1;
1028  }
1029  if ( !pPars->fSizeOnly && !pPars->fAddBufs && pNtk->vPhases == NULL )
1030  {
1031  Abc_Print( -1, "Fanin phase information is not avaiable.\n" );
1032  return 1;
1033  }
1034  if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1035  {
1036  Abc_Print( -1, "Library delay info is not available.\n" );
1037  return 1;
1038  }
1039  // modify the current network
1040  pNtkRes = Abc_SclBufferingPerform( pNtk, (SC_Lib *)pAbc->pLibScl, pPars );
1041  if ( pNtkRes == NULL )
1042  {
1043  Abc_Print( -1, "The command has failed.\n" );
1044  return 1;
1045  }
1046  // replace the current network
1047  Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
1048  return 0;
1049 
1050 usage:
1051  fprintf( pAbc->Err, "usage: buffer [-GSN num] [-sbpcvwh]\n" );
1052  fprintf( pAbc->Err, "\t performs buffering and sizing and mapped network\n" );
1053  fprintf( pAbc->Err, "\t-G <num> : target gain percentage [default = %d]\n", pPars->GainRatio );
1054  fprintf( pAbc->Err, "\t-S <num> : target slew in pisoseconds [default = %d]\n", pPars->Slew );
1055  fprintf( pAbc->Err, "\t-N <num> : the maximum fanout count [default = %d]\n", pPars->nDegree );
1056  fprintf( pAbc->Err, "\t-s : toggle performing only sizing [default = %s]\n", pPars->fSizeOnly? "yes": "no" );
1057  fprintf( pAbc->Err, "\t-b : toggle using buffers instead of inverters [default = %s]\n", pPars->fAddBufs? "yes": "no" );
1058  fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", pPars->fBufPis? "yes": "no" );
1059  fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
1060  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
1061  fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
1062  fprintf( pAbc->Err, "\t-h : print the command usage\n");
1063  return 1;
1064 }
char * memset()
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition: mainFrame.c:493
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
int fBufPis
Definition: sclLib.h:97
int fAddBufs
Definition: sclLib.h:96
int Abc_SclHasDelayInfo(void *pScl)
Definition: sclLibUtil.c:292
Abc_Ntk_t * Abc_SclBufferingPerform(Abc_Ntk_t *pNtk, SC_Lib *pLib, SC_BusPars *pPars)
Definition: sclBufSize.c:480
int fUseWireLoads
Definition: sclLib.h:98
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int fSizeOnly
Definition: sclLib.h:95
int fVeryVerbose
Definition: sclLib.h:100
int globalUtilOptind
Definition: extraUtilUtil.c:45
Vec_Int_t * vPhases
Definition: abc.h:208
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int nDegree
Definition: sclLib.h:94
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int GainRatio
Definition: sclLib.h:92
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Slew
Definition: sclLib.h:93
float Abc_SclComputeAverageSlew(SC_Lib *p)
Definition: sclLibUtil.c:317
int fVerbose
Definition: sclLib.h:99
int Scl_CommandBufferOld ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1077 of file scl.c.

1078 {
1079  Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1080  Abc_Ntk_t * pNtkRes;
1081  int FanMin, FanMax, FanMaxR, fAddInvs, fUseInvs, fBufPis, fSkipDup;
1082  int c, fVerbose;
1083  int fOldAlgo = 0;
1084  FanMin = 6;
1085  FanMax = 14;
1086  FanMaxR = 0;
1087  fAddInvs = 0;
1088  fUseInvs = 0;
1089  fBufPis = 0;
1090  fSkipDup = 0;
1091  fVerbose = 0;
1093  while ( ( c = Extra_UtilGetopt( argc, argv, "NMRaixpdvh" ) ) != EOF )
1094  {
1095  switch ( c )
1096  {
1097  case 'N':
1098  if ( globalUtilOptind >= argc )
1099  {
1100  Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
1101  goto usage;
1102  }
1103  FanMin = atoi(argv[globalUtilOptind]);
1104  globalUtilOptind++;
1105  if ( FanMin < 0 )
1106  goto usage;
1107  break;
1108  case 'M':
1109  if ( globalUtilOptind >= argc )
1110  {
1111  Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" );
1112  goto usage;
1113  }
1114  FanMax = atoi(argv[globalUtilOptind]);
1115  globalUtilOptind++;
1116  if ( FanMax < 0 )
1117  goto usage;
1118  break;
1119  case 'R':
1120  if ( globalUtilOptind >= argc )
1121  {
1122  Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" );
1123  goto usage;
1124  }
1125  FanMaxR = atoi(argv[globalUtilOptind]);
1126  globalUtilOptind++;
1127  if ( FanMaxR < 0 )
1128  goto usage;
1129  break;
1130  case 'a':
1131  fOldAlgo ^= 1;
1132  break;
1133  case 'i':
1134  fAddInvs ^= 1;
1135  break;
1136  case 'x':
1137  fUseInvs ^= 1;
1138  break;
1139  case 'p':
1140  fBufPis ^= 1;
1141  break;
1142  case 'd':
1143  fSkipDup ^= 1;
1144  break;
1145  case 'v':
1146  fVerbose ^= 1;
1147  break;
1148  case 'h':
1149  goto usage;
1150  default:
1151  goto usage;
1152  }
1153  }
1154 
1155  if ( pNtk == NULL )
1156  {
1157  Abc_Print( -1, "Empty network.\n" );
1158  return 1;
1159  }
1160  if ( !Abc_NtkIsLogic(pNtk) )
1161  {
1162  Abc_Print( -1, "This command can only be applied to a logic network.\n" );
1163  return 1;
1164  }
1165  if ( fAddInvs && pNtk->vPhases == NULL )
1166  {
1167  Abc_Print( -1, "Fanin phase information is not avaiable.\n" );
1168  return 1;
1169  }
1170  if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1171  {
1172  Abc_Print( -1, "Library delay info is not available.\n" );
1173  return 1;
1174  }
1175 
1176  // modify the current network
1177  if ( fAddInvs )
1178  pNtkRes = Abc_SclBufferPhase( pNtk, fVerbose );
1179  else if ( fOldAlgo )
1180  pNtkRes = Abc_SclPerformBuffering( pNtk, FanMaxR, FanMax, fUseInvs, fVerbose );
1181  else
1182  pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fBufPis, fSkipDup, fVerbose );
1183  if ( pNtkRes == NULL )
1184  {
1185  Abc_Print( -1, "The command has failed.\n" );
1186  return 1;
1187  }
1188  // replace the current network
1189  Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
1190  return 0;
1191 
1192 usage:
1193  fprintf( pAbc->Err, "usage: _buffer [-NMR num] [-aixpdvh]\n" );
1194  fprintf( pAbc->Err, "\t performs buffering of the mapped network\n" );
1195  fprintf( pAbc->Err, "\t-N <num> : the min fanout considered by the algorithm [default = %d]\n", FanMin );
1196  fprintf( pAbc->Err, "\t-M <num> : the max allowed fanout count of node/buffer [default = %d]\n", FanMax );
1197  fprintf( pAbc->Err, "\t-R <num> : the max allowed fanout count of root node [default = %d]\n", FanMaxR );
1198  fprintf( pAbc->Err, "\t-a : toggle using old algorithm [default = %s]\n", fOldAlgo? "yes": "no" );
1199  fprintf( pAbc->Err, "\t-i : toggle adding interters instead of buffering [default = %s]\n", fAddInvs? "yes": "no" );
1200  fprintf( pAbc->Err, "\t-x : toggle using interters instead of buffers [default = %s]\n", fUseInvs? "yes": "no" );
1201  fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", fBufPis? "yes": "no" );
1202  fprintf( pAbc->Err, "\t-d : toggle disabling gate duplication [default = %s]\n", fSkipDup? "yes": "no" );
1203  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1204  fprintf( pAbc->Err, "\t-h : print the command usage\n");
1205  return 1;
1206 }
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition: mainFrame.c:493
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
int Abc_SclHasDelayInfo(void *pScl)
Definition: sclLibUtil.c:292
Abc_Ntk_t * Abc_SclBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
Definition: sclBuffer.c:198
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
Vec_Int_t * vPhases
Definition: abc.h:208
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
Abc_Ntk_t * Abc_SclBufPerform(Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose)
Definition: sclBuffer.c:984
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
Abc_Ntk_t * Abc_SclPerformBuffering(Abc_Ntk_t *p, int DegreeR, int Degree, int fUseInvs, int fVerbose)
Definition: sclBuffer.c:457
int Scl_CommandDnsize ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1556 of file scl.c.

1557 {
1558  SC_SizePars Pars, * pPars = &Pars;
1559  Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1560  int c;
1561  memset( pPars, 0, sizeof(SC_SizePars) );
1562  pPars->nIters = 5;
1563  pPars->nIterNoChange = 50;
1564  pPars->Notches = 1000;
1565  pPars->DelayUser = 0;
1566  pPars->DelayGap = 1000;
1567  pPars->TimeOut = 0;
1568  pPars->BuffTreeEst = 0;
1569  pPars->fUseDept = 1;
1570  pPars->fUseWireLoads = 1;
1571  pPars->fDumpStats = 0;
1572  pPars->fVerbose = 0;
1573  pPars->fVeryVerbose = 0;
1575  while ( ( c = Extra_UtilGetopt( argc, argv, "IJNDGTXcsdvwh" ) ) != EOF )
1576  {
1577  switch ( c )
1578  {
1579  case 'I':
1580  if ( globalUtilOptind >= argc )
1581  {
1582  Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" );
1583  goto usage;
1584  }
1585  pPars->nIters = atoi(argv[globalUtilOptind]);
1586  globalUtilOptind++;
1587  if ( pPars->nIters < 0 )
1588  goto usage;
1589  break;
1590  case 'J':
1591  if ( globalUtilOptind >= argc )
1592  {
1593  Abc_Print( -1, "Command line switch \"-J\" should be followed by a positive integer.\n" );
1594  goto usage;
1595  }
1596  pPars->nIterNoChange = atoi(argv[globalUtilOptind]);
1597  globalUtilOptind++;
1598  if ( pPars->nIterNoChange < 0 )
1599  goto usage;
1600  break;
1601  case 'N':
1602  if ( globalUtilOptind >= argc )
1603  {
1604  Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
1605  goto usage;
1606  }
1607  pPars->Notches = atoi(argv[globalUtilOptind]);
1608  globalUtilOptind++;
1609  if ( pPars->Notches < 0 )
1610  goto usage;
1611  break;
1612  case 'D':
1613  if ( globalUtilOptind >= argc )
1614  {
1615  Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" );
1616  goto usage;
1617  }
1618  pPars->DelayUser = atoi(argv[globalUtilOptind]);
1619  globalUtilOptind++;
1620  if ( pPars->DelayUser < 0 )
1621  goto usage;
1622  break;
1623  case 'G':
1624  if ( globalUtilOptind >= argc )
1625  {
1626  Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" );
1627  goto usage;
1628  }
1629  pPars->DelayGap = atoi(argv[globalUtilOptind]);
1630  globalUtilOptind++;
1631  break;
1632  case 'T':
1633  if ( globalUtilOptind >= argc )
1634  {
1635  Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer.\n" );
1636  goto usage;
1637  }
1638  pPars->TimeOut = atoi(argv[globalUtilOptind]);
1639  globalUtilOptind++;
1640  if ( pPars->TimeOut < 0 )
1641  goto usage;
1642  break;
1643  case 'X':
1644  if ( globalUtilOptind >= argc )
1645  {
1646  Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
1647  goto usage;
1648  }
1649  pPars->BuffTreeEst = atoi(argv[globalUtilOptind]);
1650  globalUtilOptind++;
1651  if ( pPars->BuffTreeEst < 0 )
1652  goto usage;
1653  break;
1654  case 'c':
1655  pPars->fUseWireLoads ^= 1;
1656  break;
1657  case 's':
1658  pPars->fUseDept ^= 1;
1659  break;
1660  case 'd':
1661  pPars->fDumpStats ^= 1;
1662  break;
1663  case 'v':
1664  pPars->fVerbose ^= 1;
1665  break;
1666  case 'w':
1667  pPars->fVeryVerbose ^= 1;
1668  break;
1669  case 'h':
1670  goto usage;
1671  default:
1672  goto usage;
1673  }
1674  }
1675 
1676  if ( Abc_FrameReadNtk(pAbc) == NULL )
1677  {
1678  fprintf( pAbc->Err, "There is no current network.\n" );
1679  return 1;
1680  }
1681  if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1682  {
1683  fprintf( pAbc->Err, "The current network is not mapped.\n" );
1684  return 1;
1685  }
1686  if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1687  {
1688  fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1689  return 1;
1690  }
1691  if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1692  {
1693  Abc_Print( -1, "Library delay info is not available.\n" );
1694  return 1;
1695  }
1696 
1697  Abc_SclDnsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, pPars );
1698  return 0;
1699 
1700 usage:
1701  fprintf( pAbc->Err, "usage: dnsize [-IJNDGTX num] [-csdvwh]\n" );
1702  fprintf( pAbc->Err, "\t selectively decreases gate sizes while maintaining delay\n" );
1703  fprintf( pAbc->Err, "\t-I <num> : the number of upsizing iterations to perform [default = %d]\n", pPars->nIters );
1704  fprintf( pAbc->Err, "\t-J <num> : the number of iterations without improvement to stop [default = %d]\n", pPars->nIterNoChange );
1705  fprintf( pAbc->Err, "\t-N <num> : limit on discrete upsizing steps at a node [default = %d]\n", pPars->Notches );
1706  fprintf( pAbc->Err, "\t-D <num> : delay target set by the user, in picoseconds [default = %d]\n", pPars->DelayUser );
1707  fprintf( pAbc->Err, "\t-G <num> : delay gap during updating, in picoseconds [default = %d]\n", pPars->DelayGap );
1708  fprintf( pAbc->Err, "\t-T <num> : approximate timeout in seconds [default = %d]\n", pPars->TimeOut );
1709  fprintf( pAbc->Err, "\t-X <num> : ratio for buffer tree estimation [default = %d]\n", pPars->BuffTreeEst );
1710  fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
1711  fprintf( pAbc->Err, "\t-s : toggle using slack based on departure times [default = %s]\n", pPars->fUseDept? "yes": "no" );
1712  fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", pPars->fDumpStats? "yes": "no" );
1713  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
1714  fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
1715  fprintf( pAbc->Err, "\t-h : print the command usage\n");
1716  return 1;
1717 }
char * memset()
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
int DelayGap
Definition: sclLib.h:78
int Abc_SclHasDelayInfo(void *pScl)
Definition: sclLibUtil.c:292
int TimeOut
Definition: sclLib.h:79
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
int fVeryVerbose
Definition: sclLib.h:86
int fVerbose
Definition: sclLib.h:85
int fUseWireLoads
Definition: sclLib.h:84
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int nIterNoChange
Definition: sclLib.h:73
int globalUtilOptind
Definition: extraUtilUtil.c:45
int DelayUser
Definition: sclLib.h:77
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Notches
Definition: sclLib.h:76
int fUseDept
Definition: sclLib.h:82
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int nIters
Definition: sclLib.h:72
int BuffTreeEst
Definition: sclLib.h:80
int fDumpStats
Definition: sclLib.h:83
void Abc_SclDnsizePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars)
Definition: sclDnsize.c:242
int Scl_CommandDumpGen ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 585 of file scl.c.

586 {
587  char * pFileName = NULL;
588  float Slew = 0; // use the library
589  float Gain = 200;
590  int nGatesMin = 4;
591  int c, fVerbose = 0;
593  while ( ( c = Extra_UtilGetopt( argc, argv, "SGMvh" ) ) != EOF )
594  {
595  switch ( c )
596  {
597  case 'S':
598  if ( globalUtilOptind >= argc )
599  {
600  Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" );
601  goto usage;
602  }
603  Slew = (float)atof(argv[globalUtilOptind]);
604  globalUtilOptind++;
605  if ( Slew <= 0.0 )
606  goto usage;
607  break;
608  case 'G':
609  if ( globalUtilOptind >= argc )
610  {
611  Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" );
612  goto usage;
613  }
614  Gain = (float)atof(argv[globalUtilOptind]);
615  globalUtilOptind++;
616  if ( Gain <= 0.0 )
617  goto usage;
618  break;
619  case 'M':
620  if ( globalUtilOptind >= argc )
621  {
622  Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" );
623  goto usage;
624  }
625  nGatesMin = atoi(argv[globalUtilOptind]);
626  globalUtilOptind++;
627  if ( nGatesMin < 0 )
628  goto usage;
629  break;
630  case 'v':
631  fVerbose ^= 1;
632  break;
633  case 'h':
634  goto usage;
635  default:
636  goto usage;
637  }
638  }
639  if ( pAbc->pLibScl == NULL )
640  {
641  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
642  goto usage;
643  }
644  if ( argc == globalUtilOptind + 1 )
645  pFileName = argv[globalUtilOptind];
646  Abc_SclDumpGenlib( pFileName, (SC_Lib *)pAbc->pLibScl, Slew, Gain, nGatesMin );
647  return 0;
648 
649 usage:
650  fprintf( pAbc->Err, "usage: dump_genlib [-SG float] [-M num] [-vh] <file>\n" );
651  fprintf( pAbc->Err, "\t writes GENLIB file for SCL library\n" );
652  fprintf( pAbc->Err, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
653  fprintf( pAbc->Err, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
654  fprintf( pAbc->Err, "\t-M num : skip gate classes whose size is less than this [default = %d]\n", nGatesMin );
655  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
656  fprintf( pAbc->Err, "\t-h : print the command usage\n");
657  fprintf( pAbc->Err, "\t<file> : optional GENLIB file name\n");
658  return 1;
659 }
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
double atof()
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
void Abc_SclDumpGenlib(char *pFileName, SC_Lib *p, float Slew, float Gain, int nGatesMin)
Definition: sclLibUtil.c:795
int Scl_CommandLeak2Area ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 389 of file scl.c.

390 {
391  float A = 1, B = 1;
392  int c, fVerbose = 0;
394  while ( ( c = Extra_UtilGetopt( argc, argv, "ABvh" ) ) != EOF )
395  {
396  switch ( c )
397  {
398  case 'A':
399  if ( globalUtilOptind >= argc )
400  {
401  Abc_Print( -1, "Command line switch \"-A\" should be followed by a floating point number.\n" );
402  goto usage;
403  }
404  A = (float)atof(argv[globalUtilOptind]);
405  globalUtilOptind++;
406  if ( A <= 0.0 )
407  goto usage;
408  break;
409  case 'B':
410  if ( globalUtilOptind >= argc )
411  {
412  Abc_Print( -1, "Command line switch \"-B\" should be followed by a floating point number.\n" );
413  goto usage;
414  }
415  B = (float)atof(argv[globalUtilOptind]);
416  globalUtilOptind++;
417  if ( B <= 0.0 )
418  goto usage;
419  break;
420  case 'v':
421  fVerbose ^= 1;
422  break;
423  case 'h':
424  goto usage;
425  default:
426  goto usage;
427  }
428  }
429  if ( pAbc->pLibScl == NULL )
430  {
431  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
432  return 1;
433  }
434  // update the current library
435  Abc_SclConvertLeakageIntoArea( (SC_Lib *)pAbc->pLibScl, A, B );
436  return 0;
437 
438 usage:
439  fprintf( pAbc->Err, "usage: leak2area [-AB float] [-v]\n" );
440  fprintf( pAbc->Err, "\t converts leakage into area: Area = A * Area + B * Leakage\n" );
441  fprintf( pAbc->Err, "\t-A float : the multiplicative coefficient to transform area [default = %.2f]\n", A );
442  fprintf( pAbc->Err, "\t-B float : the multiplicative coefficient to transform leakage [default = %.2f]\n", B );
443  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
444  fprintf( pAbc->Err, "\t-h : print the help massage\n" );
445  return 1;
446 }
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
double atof()
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
void Abc_SclConvertLeakageIntoArea(SC_Lib *p, float A, float B)
Definition: sclLibUtil.c:584
int Scl_CommandMaxsize ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1281 of file scl.c.

1282 {
1283  Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1284  int c, fVerbose = 0;
1286  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1287  {
1288  switch ( c )
1289  {
1290  case 'v':
1291  fVerbose ^= 1;
1292  break;
1293  case 'h':
1294  goto usage;
1295  default:
1296  goto usage;
1297  }
1298  }
1299 
1300  if ( Abc_FrameReadNtk(pAbc) == NULL )
1301  {
1302  fprintf( pAbc->Err, "There is no current network.\n" );
1303  return 1;
1304  }
1305  if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1306  {
1307  fprintf( pAbc->Err, "The current network is not mapped.\n" );
1308  return 1;
1309  }
1310  if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1311  {
1312  fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1313  return 1;
1314  }
1315  if ( pAbc->pLibScl == NULL )
1316  {
1317  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
1318  return 1;
1319  }
1320 
1321  Abc_SclMinsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, 1, fVerbose );
1322  return 0;
1323 
1324 usage:
1325  fprintf( pAbc->Err, "usage: maxsize [-vh]\n" );
1326  fprintf( pAbc->Err, "\t upsizes all gates to their maximum size\n" );
1327  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1328  fprintf( pAbc->Err, "\t-h : print the command usage\n");
1329  return 1;
1330 }
void Abc_SclMinsizePerform(SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax, int fVerbose)
Definition: sclUtil.c:185
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandMinsize ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1219 of file scl.c.

1220 {
1221  Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1222  int c, fVerbose = 0;
1224  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1225  {
1226  switch ( c )
1227  {
1228  case 'v':
1229  fVerbose ^= 1;
1230  break;
1231  case 'h':
1232  goto usage;
1233  default:
1234  goto usage;
1235  }
1236  }
1237 
1238  if ( Abc_FrameReadNtk(pAbc) == NULL )
1239  {
1240  fprintf( pAbc->Err, "There is no current network.\n" );
1241  return 1;
1242  }
1243  if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1244  {
1245  fprintf( pAbc->Err, "The current network is not mapped.\n" );
1246  return 1;
1247  }
1248  if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1249  {
1250  fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1251  return 1;
1252  }
1253  if ( pAbc->pLibScl == NULL )
1254  {
1255  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
1256  return 1;
1257  }
1258 
1259  Abc_SclMinsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, 0, fVerbose );
1260  return 0;
1261 
1262 usage:
1263  fprintf( pAbc->Err, "usage: minsize [-vh]\n" );
1264  fprintf( pAbc->Err, "\t downsizes all gates to their minimum size\n" );
1265  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1266  fprintf( pAbc->Err, "\t-h : print the command usage\n");
1267  return 1;
1268 }
void Abc_SclMinsizePerform(SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax, int fVerbose)
Definition: sclUtil.c:185
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandPrintBuf ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1730 of file scl.c.

1731 {
1732  Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1733  int c, fVerbose = 0;
1735  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1736  {
1737  switch ( c )
1738  {
1739  case 'v':
1740  fVerbose ^= 1;
1741  break;
1742  case 'h':
1743  goto usage;
1744  default:
1745  goto usage;
1746  }
1747  }
1748 
1749  if ( Abc_FrameReadNtk(pAbc) == NULL )
1750  {
1751  fprintf( pAbc->Err, "There is no current network.\n" );
1752  return 1;
1753  }
1754  if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1755  {
1756  fprintf( pAbc->Err, "The current network is not mapped.\n" );
1757  return 1;
1758  }
1759  if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1760  {
1761  fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1762  return 1;
1763  }
1764  if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1765  {
1766  Abc_Print( -1, "Library delay info is not available.\n" );
1767  return 1;
1768  }
1769 
1770  Abc_SclPrintBuffers( (SC_Lib *)pAbc->pLibScl, pNtk, fVerbose );
1771  return 0;
1772 
1773 usage:
1774  fprintf( pAbc->Err, "usage: print_buf [-vh]\n" );
1775  fprintf( pAbc->Err, "\t prints buffers trees of the current design\n" );
1776  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1777  fprintf( pAbc->Err, "\t-h : print the command usage\n");
1778  return 1;
1779 }
void Abc_SclPrintBuffers(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fVerbose)
Definition: sclSize.c:876
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
int Abc_SclHasDelayInfo(void *pScl)
Definition: sclLibUtil.c:292
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandPrintConstr ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1847 of file scl.c.

1848 {
1849  int c, fVerbose = 0;
1851  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1852  {
1853  switch ( c )
1854  {
1855  case 'v':
1856  fVerbose ^= 1;
1857  break;
1858  case 'h':
1859  goto usage;
1860  default:
1861  goto usage;
1862  }
1863  }
1864  printf( "Primary input driving cell = %s\n", Abc_FrameReadDrivingCell() );
1865  printf( "Primary output maximum load = %f\n", Abc_FrameReadMaxLoad() );
1866  return 0;
1867 
1868 usage:
1869  fprintf( pAbc->Err, "usage: print_constr [-vh] <file>\n" );
1870  fprintf( pAbc->Err, "\t prints current timing constraints\n" );
1871  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1872  fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
1873  fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
1874  return 1;
1875 }
ABC_DLL float Abc_FrameReadMaxLoad()
Definition: mainFrame.c:98
ABC_DLL char * Abc_FrameReadDrivingCell()
Definition: mainFrame.c:97
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandPrintGS ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 672 of file scl.c.

673 {
674  int c;
675 
677  while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
678  {
679  switch ( c )
680  {
681  case 'h':
682  goto usage;
683  default:
684  goto usage;
685  }
686  }
687  if ( Abc_FrameReadNtk(pAbc) == NULL )
688  {
689  fprintf( pAbc->Err, "There is no current network.\n" );
690  return 1;
691  }
692  if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
693  {
694  fprintf( pAbc->Err, "The current network is not mapped.\n" );
695  return 1;
696  }
697  if ( pAbc->pLibScl == NULL )
698  {
699  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
700  return 1;
701  }
702 
703  // save current library
704  Abc_SclPrintGateSizes( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc) );
705  return 0;
706 
707 usage:
708  fprintf( pAbc->Err, "usage: print_gs [-h]\n" );
709  fprintf( pAbc->Err, "\t prints gate sizes in the current mapping\n" );
710  fprintf( pAbc->Err, "\t-h : print the help massage\n" );
711  return 1;
712 }
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
void Abc_SclPrintGateSizes(SC_Lib *pLib, Abc_Ntk_t *p)
Definition: sclUtil.c:137
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandPrintLib ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file scl.c.

312 {
313  float Slew = 0; // use library
314  float Gain = 100;
315  int fInvOnly = 0;
316  int fShort = 0;
317  int c;
319  while ( ( c = Extra_UtilGetopt( argc, argv, "SGish" ) ) != EOF )
320  {
321  switch ( c )
322  {
323  case 'S':
324  if ( globalUtilOptind >= argc )
325  {
326  Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" );
327  goto usage;
328  }
329  Slew = (float)atof(argv[globalUtilOptind]);
330  globalUtilOptind++;
331  if ( Slew <= 0.0 )
332  goto usage;
333  break;
334  case 'G':
335  if ( globalUtilOptind >= argc )
336  {
337  Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" );
338  goto usage;
339  }
340  Gain = (float)atof(argv[globalUtilOptind]);
341  globalUtilOptind++;
342  if ( Gain <= 0.0 )
343  goto usage;
344  break;
345  case 'i':
346  fInvOnly ^= 1;
347  break;
348  case 's':
349  fShort ^= 1;
350  break;
351  case 'h':
352  goto usage;
353  default:
354  goto usage;
355  }
356  }
357  if ( pAbc->pLibScl == NULL )
358  {
359  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
360  return 1;
361  }
362 
363  // save current library
364  Abc_SclPrintCells( (SC_Lib *)pAbc->pLibScl, Slew, Gain, fInvOnly, fShort );
365  return 0;
366 
367 usage:
368  fprintf( pAbc->Err, "usage: print_lib [-SG float] [-ish]\n" );
369  fprintf( pAbc->Err, "\t prints statistics of Liberty library\n" );
370  fprintf( pAbc->Err, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
371  fprintf( pAbc->Err, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
372  fprintf( pAbc->Err, "\t-i : toggle printing invs/bufs only [default = %s]\n", fInvOnly? "yes": "no" );
373  fprintf( pAbc->Err, "\t-s : toggle printing in short format [default = %s]\n", fShort? "yes": "no" );
374  fprintf( pAbc->Err, "\t-h : print the help massage\n" );
375  return 1;
376 }
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
void Abc_SclPrintCells(SC_Lib *p, float Slew, float Gain, int fInvOnly, int fShort)
Definition: sclLibUtil.c:503
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
double atof()
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandReadConstr ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1792 of file scl.c.

1793 {
1794  extern void Abc_SclReadTimingConstr( Abc_Frame_t * pAbc, char * pFileName, int fVerbose );
1795  FILE * pFile;
1796  char * pFileName;
1797  int c, fVerbose = 0;
1798 
1800  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1801  {
1802  switch ( c )
1803  {
1804  case 'v':
1805  fVerbose ^= 1;
1806  break;
1807  case 'h':
1808  goto usage;
1809  default:
1810  goto usage;
1811  }
1812  }
1813  if ( argc != globalUtilOptind + 1 )
1814  goto usage;
1815 
1816  // get the input file name
1817  pFileName = argv[globalUtilOptind];
1818  if ( (pFile = fopen( pFileName, "rb" )) == NULL )
1819  {
1820  fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
1821  return 1;
1822  }
1823  fclose( pFile );
1824  Abc_SclReadTimingConstr( pAbc, pFileName, fVerbose );
1825  return 0;
1826 
1827 usage:
1828  fprintf( pAbc->Err, "usage: read_constr [-vh] <file>\n" );
1829  fprintf( pAbc->Err, "\t read file with timing constraints for standard-cell designs\n" );
1830  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1831  fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
1832  fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
1833  return 1;
1834 }
void Abc_SclReadTimingConstr(Abc_Frame_t *pAbc, char *pFileName, int fVerbose)
Definition: sclUtil.c:229
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandReadLib ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

DECLARATIONS ///.

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

FileName [scl.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Standard-cell library representation.]

Synopsis [Relevant command handlers.]

Author [Alan Mishchenko, Niklas Een]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 24, 2012.]

Revision [

Id:
scl.c,v 1.0 2012/08/24 00:00:00 alanmi Exp

]

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file scl.c.

134 {
135  char * pFileName;
136  FILE * pFile;
137  SC_Lib * pLib;
138  int c, fDump = 0;
139  float Slew = 0;
140  float Gain = 0;
141  int nGatesMin = 0;
142  int fVerbose = 1;
143  int fVeryVerbose = 0;
144 
146  while ( ( c = Extra_UtilGetopt( argc, argv, "SGMdvwh" ) ) != EOF )
147  {
148  switch ( c )
149  {
150  case 'S':
151  if ( globalUtilOptind >= argc )
152  {
153  Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" );
154  goto usage;
155  }
156  Slew = (float)atof(argv[globalUtilOptind]);
157  globalUtilOptind++;
158  if ( Slew <= 0.0 )
159  goto usage;
160  break;
161  case 'G':
162  if ( globalUtilOptind >= argc )
163  {
164  Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" );
165  goto usage;
166  }
167  Gain = (float)atof(argv[globalUtilOptind]);
168  globalUtilOptind++;
169  if ( Gain <= 0.0 )
170  goto usage;
171  break;
172  case 'M':
173  if ( globalUtilOptind >= argc )
174  {
175  Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" );
176  goto usage;
177  }
178  nGatesMin = atoi(argv[globalUtilOptind]);
179  globalUtilOptind++;
180  if ( nGatesMin < 0 )
181  goto usage;
182  break;
183  case 'd':
184  fDump ^= 1;
185  break;
186  case 'v':
187  fVerbose ^= 1;
188  break;
189  case 'w':
190  fVeryVerbose ^= 1;
191  break;
192  case 'h':
193  goto usage;
194  default:
195  goto usage;
196  }
197  }
198  if ( argc != globalUtilOptind + 1 )
199  goto usage;
200  // get the input file name
201  pFileName = argv[globalUtilOptind];
202  if ( (pFile = fopen( pFileName, "rb" )) == NULL )
203  {
204  fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
205  return 1;
206  }
207  fclose( pFile );
208  // read new library
209  pLib = Abc_SclReadLiberty( pFileName, fVerbose, fVeryVerbose );
210  if ( pLib == NULL )
211  {
212  fprintf( pAbc->Err, "Reading SCL library from file \"%s\" has failed. \n", pFileName );
213  return 1;
214  }
215  if ( Abc_SclLibClassNum(pLib) < 3 )
216  {
217  fprintf( pAbc->Err, "Library with only %d cell classes cannot be used.\n", Abc_SclLibClassNum(pLib) );
218  Abc_SclLibFree(pLib);
219  return 0;
220  }
221  Abc_SclLoad( pLib, (SC_Lib **)&pAbc->pLibScl );
222  // dump the resulting library
223  if ( fDump && pAbc->pLibScl )
224  Abc_SclWriteLiberty( Extra_FileNameGenericAppend(pFileName, "_temp.lib"), (SC_Lib *)pAbc->pLibScl );
225  // extract genlib library
226  if ( pAbc->pLibScl )
227  Abc_SclInstallGenlib( pAbc->pLibScl, Slew, Gain, nGatesMin );
228  return 0;
229 
230 usage:
231  fprintf( pAbc->Err, "usage: read_lib [-SG float] [-M num] [-dvwh] <file>\n" );
232  fprintf( pAbc->Err, "\t reads Liberty library from file\n" );
233  fprintf( pAbc->Err, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
234  fprintf( pAbc->Err, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
235  fprintf( pAbc->Err, "\t-M num : skip gate classes whose size is less than this [default = %d]\n", nGatesMin );
236  fprintf( pAbc->Err, "\t-d : toggle dumping the parsed library into file \"*_temp.lib\" [default = %s]\n", fDump? "yes": "no" );
237  fprintf( pAbc->Err, "\t-v : toggle writing verbose information [default = %s]\n", fVerbose? "yes": "no" );
238  fprintf( pAbc->Err, "\t-v : toggle writing information about skipped gates [default = %s]\n", fVeryVerbose? "yes": "no" );
239  fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
240  fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
241  return 1;
242 }
SC_Lib * Abc_SclReadLiberty(char *pFileName, int fVerbose, int fVeryVerbose)
Definition: sclLiberty.c:1626
void Abc_SclLoad(SC_Lib *pLib, SC_Lib **ppScl)
FUNCTION DEFINITIONS ///.
Definition: scl.c:68
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
void Abc_SclWriteLiberty(char *pFileName, SC_Lib *p)
Definition: sclLibScl.c:660
int globalUtilOptind
Definition: extraUtilUtil.c:45
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Abc_SclLibClassNum(SC_Lib *pLib)
Definition: sclLibUtil.c:93
double atof()
void Abc_SclInstallGenlib(void *pScl, float Slew, float Gain, int nGatesMin)
Definition: sclLibUtil.c:844
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
static void Abc_SclLibFree(SC_Lib *p)
Definition: sclLib.h:443
int Scl_CommandReadScl ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 461 of file scl.c.

462 {
463  FILE * pFile;
464  SC_Lib * pLib;
465  char * pFileName;
466  int c, fDump = 0;
467 
469  while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF )
470  {
471  switch ( c )
472  {
473  case 'd':
474  fDump ^= 1;
475  break;
476  case 'h':
477  goto usage;
478  default:
479  goto usage;
480  }
481  }
482  if ( argc != globalUtilOptind + 1 )
483  goto usage;
484 
485  // get the input file name
486  pFileName = argv[globalUtilOptind];
487  if ( (pFile = fopen( pFileName, "rb" )) == NULL )
488  {
489  fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
490  return 1;
491  }
492  fclose( pFile );
493 
494  // read new library
495  pLib = Abc_SclReadFromFile( pFileName );
496  if ( pLib == NULL )
497  {
498  fprintf( pAbc->Err, "Reading SCL library from file \"%s\" has failed. \n", pFileName );
499  return 1;
500  }
501  Abc_SclLoad( pLib, (SC_Lib **)&pAbc->pLibScl );
502  if ( fDump )
503  Abc_SclWriteLiberty( Extra_FileNameGenericAppend(pFileName, "_temp.lib"), (SC_Lib *)pAbc->pLibScl );
504  // extract genlib library
505  if ( pAbc->pLibScl )
506  Abc_SclInstallGenlib( pAbc->pLibScl, 0, 0, 0 );
507  return 0;
508 
509 usage:
510  fprintf( pAbc->Err, "usage: read_scl [-dh] <file>\n" );
511  fprintf( pAbc->Err, "\t reads extracted Liberty library from file\n" );
512  fprintf( pAbc->Err, "\t-d : toggle dumping the parsed library into file \"*_temp.lib\" [default = %s]\n", fDump? "yes": "no" );
513  fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
514  fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
515  return 1;
516 }
SC_Lib * Abc_SclReadFromFile(char *pFileName)
Definition: sclLibScl.c:248
void Abc_SclLoad(SC_Lib *pLib, SC_Lib **ppScl)
FUNCTION DEFINITIONS ///.
Definition: scl.c:68
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
void Abc_SclWriteLiberty(char *pFileName, SC_Lib *p)
Definition: sclLibScl.c:660
int globalUtilOptind
Definition: extraUtilUtil.c:45
void Abc_SclInstallGenlib(void *pScl, float Slew, float Gain, int nGatesMin)
Definition: sclLibUtil.c:844
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int Scl_CommandResetConstr ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1888 of file scl.c.

1889 {
1890  int c, fVerbose = 0;
1892  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1893  {
1894  switch ( c )
1895  {
1896  case 'v':
1897  fVerbose ^= 1;
1898  break;
1899  case 'h':
1900  goto usage;
1901  default:
1902  goto usage;
1903  }
1904  }
1905  Abc_FrameSetDrivingCell( NULL );
1906  Abc_FrameSetMaxLoad( 0 );
1907  return 0;
1908 
1909 usage:
1910  fprintf( pAbc->Err, "usage: reset_constr [-vh] <file>\n" );
1911  fprintf( pAbc->Err, "\t removes current timing constraints\n" );
1912  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1913  fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
1914  fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
1915  return 1;
1916 }
ABC_DLL void Abc_FrameSetMaxLoad(float Load)
Definition: mainFrame.c:100
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
ABC_DLL void Abc_FrameSetDrivingCell(char *pName)
Definition: mainFrame.c:99
int Scl_CommandStime ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 725 of file scl.c.

726 {
727  int c;
728  int fShowAll = 0;
729  int fUseWireLoads = 1;
730  int fPrintPath = 0;
731  int fDumpStats = 0;
732  int nTreeCRatio = 0;
733 
735  while ( ( c = Extra_UtilGetopt( argc, argv, "Xcapdh" ) ) != EOF )
736  {
737  switch ( c )
738  {
739  case 'X':
740  if ( globalUtilOptind >= argc )
741  {
742  Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
743  goto usage;
744  }
745  nTreeCRatio = atoi(argv[globalUtilOptind]);
747  if ( nTreeCRatio < 0 )
748  goto usage;
749  break;
750  case 'c':
751  fUseWireLoads ^= 1;
752  break;
753  case 'a':
754  fShowAll ^= 1;
755  break;
756  case 'p':
757  fPrintPath ^= 1;
758  break;
759  case 'd':
760  fDumpStats ^= 1;
761  break;
762  case 'h':
763  goto usage;
764  default:
765  goto usage;
766  }
767  }
768 
769  if ( Abc_FrameReadNtk(pAbc) == NULL )
770  {
771  fprintf( pAbc->Err, "There is no current network.\n" );
772  return 1;
773  }
774  if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
775  {
776  fprintf( pAbc->Err, "The current network is not mapped.\n" );
777  return 1;
778  }
779  if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
780  {
781  fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
782  return 1;
783  }
784  if ( pAbc->pLibScl == NULL )
785  {
786  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
787  return 1;
788  }
789 
790  Abc_SclTimePerform( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc), nTreeCRatio, fUseWireLoads, fShowAll, fPrintPath, fDumpStats );
791  return 0;
792 
793 usage:
794  fprintf( pAbc->Err, "usage: stime [-X num] [-capdth]\n" );
795  fprintf( pAbc->Err, "\t performs STA using Liberty library\n" );
796  fprintf( pAbc->Err, "\t-X : min Cout/Cave ratio for tree estimations [default = %d]\n", nTreeCRatio );
797  fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", fUseWireLoads? "yes": "no" );
798  fprintf( pAbc->Err, "\t-a : display timing information for all nodes [default = %s]\n", fShowAll? "yes": "no" );
799  fprintf( pAbc->Err, "\t-p : display timing information for critical path [default = %s]\n", fPrintPath? "yes": "no" );
800  fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", fDumpStats? "yes": "no" );
801  fprintf( pAbc->Err, "\t-h : print the help massage\n" );
802  return 1;
803 }
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
void Abc_SclTimePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats)
Definition: sclSize.c:671
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandTopo ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 816 of file scl.c.

817 {
818  Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
819  Abc_Ntk_t * pNtkRes;
820  int c, fVerbose = 0;
822  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
823  {
824  switch ( c )
825  {
826  case 'v':
827  fVerbose ^= 1;
828  break;
829  case 'h':
830  goto usage;
831  default:
832  goto usage;
833  }
834  }
835 
836  if ( pNtk == NULL )
837  {
838  Abc_Print( -1, "Empty network.\n" );
839  return 1;
840  }
841  if ( !Abc_NtkIsLogic(pNtk) )
842  {
843  Abc_Print( -1, "This command can only be applied to a logic network.\n" );
844  return 1;
845  }
846 
847  // modify the current network
848  pNtkRes = Abc_NtkDupDfs( pNtk );
849  if ( pNtkRes == NULL )
850  {
851  Abc_Print( -1, "The command has failed.\n" );
852  return 1;
853  }
854  // replace the current network
855  Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
856  return 0;
857 
858 usage:
859  fprintf( pAbc->Err, "usage: topo [-vh]\n" );
860  fprintf( pAbc->Err, "\t rearranges nodes to be in a topological order\n" );
861  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
862  fprintf( pAbc->Err, "\t-h : print the command usage\n");
863  return 1;
864 }
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition: mainFrame.c:493
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandUnBuffer ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 877 of file scl.c.

878 {
879  Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc);
880  int c, fRemInv = 0, fVerbose = 0;
882  while ( ( c = Extra_UtilGetopt( argc, argv, "ivh" ) ) != EOF )
883  {
884  switch ( c )
885  {
886  case 'i':
887  fRemInv ^= 1;
888  break;
889  case 'v':
890  fVerbose ^= 1;
891  break;
892  case 'h':
893  goto usage;
894  default:
895  goto usage;
896  }
897  }
898 
899  if ( pNtk == NULL )
900  {
901  fprintf( pAbc->Err, "There is no current network.\n" );
902  return 1;
903  }
904  if ( !Abc_NtkIsLogic(pNtk) )
905  {
906  fprintf( pAbc->Err, "The current network is not a logic network.\n" );
907  return 1;
908  }
909  if ( fRemInv )
910  pNtkRes = Abc_SclUnBufferPhase( pNtk, fVerbose );
911  else
912  pNtkRes = Abc_SclUnBufferPerform( pNtk, fVerbose );
913  if ( pNtkRes == NULL )
914  {
915  Abc_Print( -1, "The command has failed.\n" );
916  return 1;
917  }
918  Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
919  return 0;
920 
921 usage:
922  fprintf( pAbc->Err, "usage: unbuffer [-ivh]\n" );
923  fprintf( pAbc->Err, "\t collapses buffer/inverter trees\n" );
924  fprintf( pAbc->Err, "\t-i : toggle removing interters [default = %s]\n", fRemInv? "yes": "no" );
925  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
926  fprintf( pAbc->Err, "\t-h : print the command usage\n");
927  return 1;
928 }
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition: mainFrame.c:493
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
Abc_Ntk_t * Abc_SclUnBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
Definition: sclBuffer.c:239
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
Abc_Ntk_t * Abc_SclUnBufferPerform(Abc_Ntk_t *pNtk, int fVerbose)
Definition: sclBuffer.c:129
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandUpsize ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1343 of file scl.c.

1344 {
1345  SC_SizePars Pars, * pPars = &Pars;
1346  Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1347  int c;
1348  memset( pPars, 0, sizeof(SC_SizePars) );
1349  pPars->nIters = 1000;
1350  pPars->nIterNoChange = 50;
1351  pPars->Window = 1;
1352  pPars->Ratio = 10;
1353  pPars->Notches = 1000;
1354  pPars->DelayUser = 0;
1355  pPars->DelayGap = 0;
1356  pPars->TimeOut = 0;
1357  pPars->BuffTreeEst = 0;
1358  pPars->BypassFreq = 0;
1359  pPars->fUseDept = 1;
1360  pPars->fUseWireLoads = 1;
1361  pPars->fDumpStats = 0;
1362  pPars->fVerbose = 0;
1363  pPars->fVeryVerbose = 0;
1365  while ( ( c = Extra_UtilGetopt( argc, argv, "IJWRNDGTXBcsdvwh" ) ) != EOF )
1366  {
1367  switch ( c )
1368  {
1369  case 'I':
1370  if ( globalUtilOptind >= argc )
1371  {
1372  Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" );
1373  goto usage;
1374  }
1375  pPars->nIters = atoi(argv[globalUtilOptind]);
1376  globalUtilOptind++;
1377  if ( pPars->nIters < 0 )
1378  goto usage;
1379  break;
1380  case 'J':
1381  if ( globalUtilOptind >= argc )
1382  {
1383  Abc_Print( -1, "Command line switch \"-J\" should be followed by a positive integer.\n" );
1384  goto usage;
1385  }
1386  pPars->nIterNoChange = atoi(argv[globalUtilOptind]);
1387  globalUtilOptind++;
1388  if ( pPars->nIterNoChange < 0 )
1389  goto usage;
1390  break;
1391  case 'W':
1392  if ( globalUtilOptind >= argc )
1393  {
1394  Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" );
1395  goto usage;
1396  }
1397  pPars->Window = atoi(argv[globalUtilOptind]);
1398  globalUtilOptind++;
1399  if ( pPars->Window < 0 )
1400  goto usage;
1401  break;
1402  case 'R':
1403  if ( globalUtilOptind >= argc )
1404  {
1405  Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" );
1406  goto usage;
1407  }
1408  pPars->Ratio = atoi(argv[globalUtilOptind]);
1409  globalUtilOptind++;
1410  if ( pPars->Ratio < 0 )
1411  goto usage;
1412  break;
1413  case 'N':
1414  if ( globalUtilOptind >= argc )
1415  {
1416  Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
1417  goto usage;
1418  }
1419  pPars->Notches = atoi(argv[globalUtilOptind]);
1420  globalUtilOptind++;
1421  if ( pPars->Notches < 0 )
1422  goto usage;
1423  break;
1424  case 'D':
1425  if ( globalUtilOptind >= argc )
1426  {
1427  Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" );
1428  goto usage;
1429  }
1430  pPars->DelayUser = atoi(argv[globalUtilOptind]);
1431  globalUtilOptind++;
1432  if ( pPars->DelayUser < 0 )
1433  goto usage;
1434  break;
1435  case 'G':
1436  if ( globalUtilOptind >= argc )
1437  {
1438  Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" );
1439  goto usage;
1440  }
1441  pPars->DelayGap = atoi(argv[globalUtilOptind]);
1442  globalUtilOptind++;
1443  break;
1444  case 'T':
1445  if ( globalUtilOptind >= argc )
1446  {
1447  Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer.\n" );
1448  goto usage;
1449  }
1450  pPars->TimeOut = atoi(argv[globalUtilOptind]);
1451  globalUtilOptind++;
1452  if ( pPars->TimeOut < 0 )
1453  goto usage;
1454  break;
1455  case 'X':
1456  if ( globalUtilOptind >= argc )
1457  {
1458  Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
1459  goto usage;
1460  }
1461  pPars->BuffTreeEst = atoi(argv[globalUtilOptind]);
1462  globalUtilOptind++;
1463  if ( pPars->BuffTreeEst < 0 )
1464  goto usage;
1465  break;
1466  case 'B':
1467  if ( globalUtilOptind >= argc )
1468  {
1469  Abc_Print( -1, "Command line switch \"-B\" should be followed by a positive integer.\n" );
1470  goto usage;
1471  }
1472  pPars->BypassFreq = atoi(argv[globalUtilOptind]);
1473  globalUtilOptind++;
1474  if ( pPars->BypassFreq < 0 )
1475  goto usage;
1476  break;
1477  case 'c':
1478  pPars->fUseWireLoads ^= 1;
1479  break;
1480  case 's':
1481  pPars->fUseDept ^= 1;
1482  break;
1483  case 'd':
1484  pPars->fDumpStats ^= 1;
1485  break;
1486  case 'v':
1487  pPars->fVerbose ^= 1;
1488  break;
1489  case 'w':
1490  pPars->fVeryVerbose ^= 1;
1491  break;
1492  case 'h':
1493  goto usage;
1494  default:
1495  goto usage;
1496  }
1497  }
1498 
1499  if ( Abc_FrameReadNtk(pAbc) == NULL )
1500  {
1501  fprintf( pAbc->Err, "There is no current network.\n" );
1502  return 1;
1503  }
1504  if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1505  {
1506  fprintf( pAbc->Err, "The current network is not mapped.\n" );
1507  return 1;
1508  }
1509  if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1510  {
1511  fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1512  return 1;
1513  }
1514  if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1515  {
1516  Abc_Print( -1, "Library delay info is not available.\n" );
1517  return 1;
1518  }
1519 
1520  Abc_SclUpsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, pPars );
1521  return 0;
1522 
1523 usage:
1524  fprintf( pAbc->Err, "usage: upsize [-IJWRNDGTXB num] [-csdvwh]\n" );
1525  fprintf( pAbc->Err, "\t selectively increases gate sizes on the critical path\n" );
1526  fprintf( pAbc->Err, "\t-I <num> : the number of upsizing iterations to perform [default = %d]\n", pPars->nIters );
1527  fprintf( pAbc->Err, "\t-J <num> : the number of iterations without improvement to stop [default = %d]\n", pPars->nIterNoChange );
1528  fprintf( pAbc->Err, "\t-W <num> : delay window (in percent) of near-critical COs [default = %d]\n", pPars->Window );
1529  fprintf( pAbc->Err, "\t-R <num> : ratio of critical nodes (in percent) to update [default = %d]\n", pPars->Ratio );
1530  fprintf( pAbc->Err, "\t-N <num> : limit on discrete upsizing steps at a node [default = %d]\n", pPars->Notches );
1531  fprintf( pAbc->Err, "\t-D <num> : delay target set by the user, in picoseconds [default = %d]\n", pPars->DelayUser );
1532  fprintf( pAbc->Err, "\t-G <num> : delay gap during updating, in picoseconds [default = %d]\n", pPars->DelayGap );
1533  fprintf( pAbc->Err, "\t-T <num> : approximate timeout in seconds [default = %d]\n", pPars->TimeOut );
1534  fprintf( pAbc->Err, "\t-X <num> : ratio for buffer tree estimation [default = %d]\n", pPars->BuffTreeEst );
1535  fprintf( pAbc->Err, "\t-B <num> : frequency of bypass transforms [default = %d]\n", pPars->BypassFreq );
1536  fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
1537  fprintf( pAbc->Err, "\t-s : toggle using slack based on departure times [default = %s]\n", pPars->fUseDept? "yes": "no" );
1538  fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", pPars->fDumpStats? "yes": "no" );
1539  fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
1540  fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
1541  fprintf( pAbc->Err, "\t-h : print the command usage\n");
1542  return 1;
1543 }
char * memset()
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
int DelayGap
Definition: sclLib.h:78
int Abc_SclHasDelayInfo(void *pScl)
Definition: sclLibUtil.c:292
void Abc_SclUpsizePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars)
Definition: sclUpsize.c:868
int TimeOut
Definition: sclLib.h:79
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
int fVeryVerbose
Definition: sclLib.h:86
int fVerbose
Definition: sclLib.h:85
int fUseWireLoads
Definition: sclLib.h:84
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int nIterNoChange
Definition: sclLib.h:73
int globalUtilOptind
Definition: extraUtilUtil.c:45
int DelayUser
Definition: sclLib.h:77
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Notches
Definition: sclLib.h:76
int fUseDept
Definition: sclLib.h:82
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int BypassFreq
Definition: sclLib.h:81
int Window
Definition: sclLib.h:74
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int nIters
Definition: sclLib.h:72
int BuffTreeEst
Definition: sclLib.h:80
int Ratio
Definition: sclLib.h:75
int fDumpStats
Definition: sclLib.h:83
int Scl_CommandWriteLib ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file scl.c.

256 {
257  FILE * pFile;
258  char * pFileName;
259  int c;
260 
262  while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
263  {
264  switch ( c )
265  {
266  case 'h':
267  goto usage;
268  default:
269  goto usage;
270  }
271  }
272  if ( argc != globalUtilOptind + 1 )
273  goto usage;
274  if ( pAbc->pLibScl == NULL )
275  {
276  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
277  return 1;
278  }
279  // get the input file name
280  pFileName = argv[globalUtilOptind];
281  if ( (pFile = fopen( pFileName, "wb" )) == NULL )
282  {
283  fprintf( pAbc->Err, "Cannot open output file \"%s\". \n", pFileName );
284  return 1;
285  }
286  fclose( pFile );
287 
288  // save current library
289  Abc_SclWriteLiberty( pFileName, (SC_Lib *)pAbc->pLibScl );
290  return 0;
291 
292 usage:
293  fprintf( pAbc->Err, "usage: write_lib [-h] <file>\n" );
294  fprintf( pAbc->Err, "\t write current Liberty library into file\n" );
295  fprintf( pAbc->Err, "\t-h : print the help massage\n" );
296  fprintf( pAbc->Err, "\t<file> : the name of the file to write\n" );
297  return 1;
298 }
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
void Abc_SclWriteLiberty(char *pFileName, SC_Lib *p)
Definition: sclLibScl.c:660
int globalUtilOptind
Definition: extraUtilUtil.c:45
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Scl_CommandWriteScl ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 529 of file scl.c.

530 {
531  FILE * pFile;
532  char * pFileName;
533  int c;
534 
536  while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
537  {
538  switch ( c )
539  {
540  case 'h':
541  goto usage;
542  default:
543  goto usage;
544  }
545  }
546  if ( argc != globalUtilOptind + 1 )
547  goto usage;
548  if ( pAbc->pLibScl == NULL )
549  {
550  fprintf( pAbc->Err, "There is no Liberty library available.\n" );
551  return 1;
552  }
553  // get the input file name
554  pFileName = argv[globalUtilOptind];
555  if ( (pFile = fopen( pFileName, "wb" )) == NULL )
556  {
557  fprintf( pAbc->Err, "Cannot open output file \"%s\". \n", pFileName );
558  return 1;
559  }
560  fclose( pFile );
561 
562  // save current library
563  Abc_SclWriteScl( pFileName, (SC_Lib *)pAbc->pLibScl );
564  return 0;
565 
566 usage:
567  fprintf( pAbc->Err, "usage: write_scl [-h] <file>\n" );
568  fprintf( pAbc->Err, "\t write extracted Liberty library into file\n" );
569  fprintf( pAbc->Err, "\t-h : print the help massage\n" );
570  fprintf( pAbc->Err, "\t<file> : the name of the file to write\n" );
571  return 1;
572 }
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
void Abc_SclWriteScl(char *pFileName, SC_Lib *p)
Definition: sclLibScl.c:444
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
void Scl_End ( Abc_Frame_t pAbc)

Definition at line 115 of file scl.c.

116 {
117  Abc_SclLoad( NULL, (SC_Lib **)&pAbc->pLibScl );
118 }
void Abc_SclLoad(SC_Lib *pLib, SC_Lib **ppScl)
FUNCTION DEFINITIONS ///.
Definition: scl.c:68
void Scl_Init ( Abc_Frame_t pAbc)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file scl.c.

92 {
93  Cmd_CommandAdd( pAbc, "SCL mapping", "read_lib", Scl_CommandReadLib, 0 );
94  Cmd_CommandAdd( pAbc, "SCL mapping", "write_lib", Scl_CommandWriteLib, 0 );
95  Cmd_CommandAdd( pAbc, "SCL mapping", "print_lib", Scl_CommandPrintLib, 0 );
96  Cmd_CommandAdd( pAbc, "SCL mapping", "leak2area", Scl_CommandLeak2Area, 0 );
97  Cmd_CommandAdd( pAbc, "SCL mapping", "read_scl", Scl_CommandReadScl, 0 );
98  Cmd_CommandAdd( pAbc, "SCL mapping", "write_scl", Scl_CommandWriteScl, 0 );
99  Cmd_CommandAdd( pAbc, "SCL mapping", "dump_genlib", Scl_CommandDumpGen, 0 );
100  Cmd_CommandAdd( pAbc, "SCL mapping", "print_gs", Scl_CommandPrintGS, 0 );
101  Cmd_CommandAdd( pAbc, "SCL mapping", "stime", Scl_CommandStime, 0 );
102  Cmd_CommandAdd( pAbc, "SCL mapping", "topo", Scl_CommandTopo, 1 );
103  Cmd_CommandAdd( pAbc, "SCL mapping", "unbuffer", Scl_CommandUnBuffer, 1 );
104  Cmd_CommandAdd( pAbc, "SCL mapping", "buffer", Scl_CommandBuffer, 1 );
105 // Cmd_CommandAdd( pAbc, "SCL mapping", "_buffer", Scl_CommandBufferOld, 1 );
106  Cmd_CommandAdd( pAbc, "SCL mapping", "minsize", Scl_CommandMinsize, 1 );
107  Cmd_CommandAdd( pAbc, "SCL mapping", "maxsize", Scl_CommandMaxsize, 1 );
108  Cmd_CommandAdd( pAbc, "SCL mapping", "upsize", Scl_CommandUpsize, 1 );
109  Cmd_CommandAdd( pAbc, "SCL mapping", "dnsize", Scl_CommandDnsize, 1 );
110  Cmd_CommandAdd( pAbc, "SCL mapping", "print_buf", Scl_CommandPrintBuf, 0 );
111  Cmd_CommandAdd( pAbc, "SCL mapping", "read_constr", Scl_CommandReadConstr, 0 );
112  Cmd_CommandAdd( pAbc, "SCL mapping", "print_constr", Scl_CommandPrintConstr, 0 );
113  Cmd_CommandAdd( pAbc, "SCL mapping", "reset_constr", Scl_CommandResetConstr, 0 );
114 }
static int Scl_CommandPrintBuf(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1730
static int Scl_CommandPrintConstr(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1847
static int Scl_CommandReadConstr(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1792
static int Scl_CommandStime(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:725
static int Scl_CommandPrintGS(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:672
static int Scl_CommandPrintLib(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:311
static int Scl_CommandReadScl(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:461
static int Scl_CommandLeak2Area(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:389
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
Definition: cmdApi.c:63
static ABC_NAMESPACE_IMPL_START int Scl_CommandReadLib(Abc_Frame_t *pAbc, int argc, char **argv)
DECLARATIONS ///.
Definition: scl.c:133
static int Scl_CommandTopo(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:816
static int Scl_CommandUpsize(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1343
static int Scl_CommandDumpGen(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:585
static int Scl_CommandResetConstr(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1888
static int Scl_CommandBuffer(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:941
static int Scl_CommandDnsize(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1556
static int Scl_CommandUnBuffer(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:877
static int Scl_CommandMaxsize(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1281
static int Scl_CommandWriteLib(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:255
static int Scl_CommandWriteScl(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:529
static int Scl_CommandMinsize(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: scl.c:1219