⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpcmd.c

📁 主要进行大规模的电路综合
💻 C
📖 第 1 页 / 共 2 页
字号:
    /* safty checks */  if ( pNet == NULL ) {      fprintf( Mv_FrameReadErr(pMvsis), "Empty network\n" );      FREE( pInfo );      return 1;  }  if (!Ntk_NetworkCheck(pNet)) {      printf("fullsimp aborted\n");      FREE( pInfo );      return 1;  }    /* complete the info initialization */  pInfo->network = pNet;  pInfo->pMvcMem = Ntk_NetworkReadManMvc( pNet );    /* read initial values of the network */  nNodes = Ntk_NetworkReadNodeIntNum( pNet );  nCost  = SimpNetworkReadCost( pInfo, pNet );    if (pInfo->timeout_net > 0) {      pInfo->timeout_net *= CLOCKS_PER_SEC;  }  if (pInfo->timeout_node > 0) {      pInfo->timeout_node *= CLOCKS_PER_SEC;  }    do {      fChanges = 0;      pInfo->nIter++;            Ntk_NetworkSweep(pNet, 0,0,0,pInfo->verbose);      fTimeout = Simp_NetworkFullSimplify(pNet, pInfo);            if (!Ntk_NetworkCheck(pNet)) {          FREE(pInfo);          printf("fullsimp aborted\n");          return 1;      }            /* test progress */      nTemp = Ntk_NetworkReadNodeIntNum( pNet );      if (nNodes != nTemp) {          fChanges = 1;          nNodes   = nTemp;      }      else {          nTemp = SimpNetworkReadCost( pInfo, pNet );          if (nCost != nTemp) {              fChanges = 1;              nCost    = nTemp;          }      }            nIter--;  } while (nIter!=0 && fChanges && !fTimeout);    FREE(pInfo);    return 0; usage:  fprintf(pErr, "Usage: fullsimp [-cfnpsrv][-d dctype][-m method][-i n][-t n][-T n]\n");  fprintf(pErr, "\t-c        : suppress conservative approach in Espresso minimization\n");  fprintf(pErr, "\t-f        : filter CODC with TFI to speed up computation   \n");  fprintf(pErr, "\t-n        : heuristic nd-relation minimization using sharp \n");  fprintf(pErr, "\t-p        : phase assignment (reset the default i-set)     \n");  fprintf(pErr, "\t-r        : suppress boolean resubstitution of subset supports\n");  fprintf(pErr, "\t-s        : make sparse after Espresso minimization        \n");  fprintf(pErr, "\t-v        : verbose for debugging                          \n");  fprintf(pErr, "\t-d dctype : don't care type                                \n");  fprintf(pErr, "\t            sdc | codc(default)                            \n");  fprintf(pErr, "\t-i n      : iterate fullsimp for n times until no change   \n");  fprintf(pErr, "\t-t n      : timeout at one node after n seconds [default=10]\n");  fprintf(pErr, "\t-T n      : timeout the whole process after n seconds [default=5000]\n");  fprintf(pErr, "\t-m method : SOP minimization methods [default=snocomp] \n");  fprintf(pErr, "\t            espresso|nocomp|snocomp|dcsimp|exact|exactlit\n");  if (pInfo) FREE(pInfo);  return 1;}/**Function********************************************************************  Synopsis    [Simplify each node using ESPRESSO.]  CommandName [simplify]  CommandSynopsis [Simplify each node using ESPRESSO]  CommandArguments []  CommandDescription [ Simplify each node in the network using local don't  cares. Satisfiability don't cares (SDC) are computed for local fanins, and  optionally for the nodes with a subset of the immediate fanin support. The  latter leads to possible Boolean resubstitution. The node is minimized by  ESPRESSO-MV using the SDC set. The simplified result replaces the old one if  it has a lower cost (cube count, literal count, or literal count in the  factored forms).  Command options:<p>    ]    SideEffects []******************************************************************************/static intSimpCommandSimplify(    Mv_Frame_t *pMvsis,    int     argc,    char ** argv){  FILE *pErr;  Ntk_Network_t *pNet;  Simp_Info_t  *pInfo=NULL;  char c;    pNet = Mv_FrameReadNet(pMvsis);  pErr = Mv_FrameReadErr(pMvsis);    pInfo = Simp_InfoInit( pMvsis, pNet );  pInfo->timeout_net  = 5000;  pInfo->use_bres     = TRUE;  pInfo->dc_type      = 1;      util_getopt_reset();  while ((c = util_getopt(argc, argv, "cnpsxrvd:m:t:T:")) != EOF) {    switch(c) {        case 'v':            pInfo->verbose = TRUE;            break;        case 'c':            pInfo->fConser = TRUE;            break;        case 'n':            pInfo->fRelatn = TRUE;            break;        case 'p':            pInfo->fPhase = TRUE;            break;        case 's':            pInfo->fSparse = TRUE;            break;        case 'r':            pInfo->use_bres = 0;            break;                    case 'd':            if (strcmp(util_optarg, "none") == 0) {                pInfo->dc_type = 0;            }            else if (strcmp(util_optarg, "sdc") == 0) {                pInfo->dc_type = 1;            }            else {                goto usage;            }            break;                     case 't':            pInfo->timeout_node = atoi(util_optarg);            if (pInfo->timeout_node < 0) goto usage;            break;        case 'T':            pInfo->timeout_net = atoi(util_optarg);            if (pInfo->timeout_net < 0) goto usage;            break;                    case 'm':            if (strcmp(util_optarg, "simple") == 0) {                pInfo->method   = SIMP_SIMPLE;                pInfo->dc_type  = 0;                pInfo->use_bres = 0;            }            else if (strcmp(util_optarg, "nocomp") == 0) {                pInfo->method = SIMP_NOCOMP;            }            else if (strcmp(util_optarg, "snocomp") == 0) {                pInfo->method = SIMP_SNOCOMP;            }            else if (strcmp(util_optarg, "dcsimp") == 0) {                pInfo->method = SIMP_DCSIMP;            }            else if (strcmp(util_optarg, "espresso") == 0) {                pInfo->method = SIMP_ESPRESSO;            }            else if (strcmp(util_optarg, "exact") == 0) {                pInfo->method = SIMP_EXACT;            }            else if (strcmp(util_optarg, "exactlit") == 0) {                pInfo->method = SIMP_EXACT_LITS;            }            else {                goto usage;            }            break;        default:            goto usage;    }  }    if ( pNet == NULL ) {      fprintf( Mv_FrameReadErr(pMvsis), "Empty network\n" );      return 1;  }    Ntk_NetworkSweep( pNet, 0,0,0,0 );  Simp_NetworkSimplify( pNet, pInfo );  Ntk_NetworkSweep( pNet, 1,1,1,0 );    if (!Ntk_NetworkCheck(pNet)) {      fail("simplify: network error after simplify!");  }    if (pInfo) FREE(pInfo);  return 0;   usage:  fprintf(pErr, "Usage: simplify [-cnpsrv][-d dctype][-t n][-T n][-m method]\n");  fprintf(pErr, "\t-c        : suppress conservative approach in Espresso minimization \n");  fprintf(pErr, "\t-n        : heuristic nd-relation minimization using sharp \n");  fprintf(pErr, "\t-p        : phase assignment (reset the default i-set)     \n");  fprintf(pErr, "\t-r        : suppress boolean resubstitution of subset supports\n");  fprintf(pErr, "\t-s        : make sparse after Espresso minimization        \n");  fprintf(pErr, "\t-v        : verbose for debugging                          \n");  fprintf(pErr, "\t-d dctype : don't care type                                \n");  fprintf(pErr, "\t            none | sdc(default)                            \n");  fprintf(pErr, "\t-t n      : timeout at one node after n seconds [default=10]\n");  fprintf(pErr, "\t-T n      : timeout the whole process after n seconds [default=5000]\n");  fprintf(pErr, "\t-m method : SOP minimization methods [default=snocomp]     \n");  fprintf(pErr, "\t            simple|espresso|nocomp|snocomp|dcsimp|exact|exactlit\n");  if (pInfo) FREE(pInfo);  return 1;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/intSimpNetworkReadCost( Simp_Info_t *pInfo, Ntk_Network_t *pNet ) {    Cvr_Cover_t *pCvr;    Ntk_Node_t  *pNode;    int         nCost;        nCost = 0;    if ( pInfo->accept == SIMP_CUBE ) {        Ntk_NetworkForEachNode( pNet, pNode ) {            pCvr = Ntk_NodeGetFuncCvr( pNode );            nCost += Cvr_CoverReadCubeNum( pCvr );        }    }    else if ( pInfo->accept == SIMP_SOP_LIT ) {        Ntk_NetworkForEachNode( pNet, pNode ) {            pCvr = Ntk_NodeGetFuncCvr( pNode );            nCost += Cvr_CoverReadLitSopNum( pCvr );        }    }    else {        Ntk_NetworkForEachNode( pNet, pNode ) {            pCvr = Ntk_NodeGetFuncCvr( pNode );            nCost += Cvr_CoverReadLitFacNum( pCvr );        }    }        return nCost;}/*---------------------------------------------------------------------------*//* Definition of internal functions                                          *//*---------------------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -