📄 ntki.c
字号:
// print the nodes Ntk_NetworkPrintValue( pOut, pNet, nNodes ); return 0;usage: fprintf( pErr, "usage: print_value [-h] <node_list>\n" ); fprintf( pErr, "\t prints the elimination value of nodes in the list\n" ); fprintf( pErr, "\t <node_list> : if empty, prints values for all nodes in the network\n" ); fprintf( pErr, "\t-h : print the command usage\n"); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandPrintFactor( Mv_Frame_t * pMvsis, int argc, char **argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; Ntk_Node_t * pNode; int nNodes, c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); // set defaults util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( pNet == NULL ) { fprintf( pErr, "Empty network.\n" ); return 1; } // collect the nodes nNodes = Cmd_CommandGetNodes( pMvsis, argc-util_optind+1, argv+util_optind-1, 0 ); if ( nNodes == 0 ) { fprintf( pErr, "The list of nodes to print is empty.\n" ); return 1; } // print the nodes Ntk_NetworkForEachNodeSpecial( pNet, pNode ) Ntk_NodePrintFactor( pOut, pNode ); return 0;usage: fprintf( pErr, "usage: print_factor [-h] <node_list>\n" ); fprintf( pErr, "\t print algebraic factored form of the nodes.\n" ); fprintf( pErr, "\t <node_list> : if empty, print all nodes in the network\n" ); fprintf( pErr, "\t-h : print the command usage\n"); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandPrintLevel( Mv_Frame_t * pMvsis, int argc, char **argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; int fFromOutputs; int nNodes, c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); // set defaults fFromOutputs = 1; util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "oh" ) ) != EOF ) { switch ( c ) { case 'o': fFromOutputs ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNet == NULL ) { fprintf( pErr, "Empty network.\n" ); return 1; } // collect the nodes if ( argc == util_optind ) nNodes = 0; else nNodes = Cmd_CommandGetNodes( pMvsis, argc-util_optind+1, argv+util_optind-1, 0 ); // print nodes by level Ntk_NetworkPrintLevel( pOut, pNet, nNodes, fFromOutputs ); return 0;usage: fprintf( pErr, "usage: print_level [-o] [-h] <node_list>\n" ); fprintf( pErr, "\t prints nodes in the network by level.\n" ); fprintf( pErr, "\t-o : toggles DFS order used to levelize [default = %s]\n", fFromOutputs? "from COs": "from CIs"); fprintf( pErr, "\t-h : print the command usage\n"); fprintf( pErr, "\t<node_list> : if empty, print all nodes in the network\n" ); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandPrintNd( Mv_Frame_t * pMvsis, int argc, char **argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; int c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); // set defaults util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( pNet == NULL ) { fprintf( pErr, "Empty network.\n" ); return 1; } // print nodes by level Ntk_NetworkPrintNd( pOut, pNet ); return 0;usage: fprintf( pErr, "usage: print_nd [-h]\n" ); fprintf( pErr, "\t prints the list of ND nodes of the current network\n" ); fprintf( pErr, "\t-h : print the command usage\n"); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandPrintSpec( Mv_Frame_t * pMvsis, int argc, char **argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; int c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); // set defaults util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( pNet == NULL ) { fprintf( pErr, "Empty network.\n" ); return 1; } // print nodes by level fprintf( pOut, "External spec file name is \"%s\".\n", pNet->pSpec ); return 0;usage: fprintf( pErr, "usage: print_spec [-h]\n" ); fprintf( pErr, "\t prints the external spec file name for the current network\n" ); fprintf( pErr, "\t-h : print the command usage\n"); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandPrintClauses( Mv_Frame_t * pMvsis, int argc, char ** argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; char * pFileName; int c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; break; default: goto usage; } } if ( pNet == NULL ) { fprintf( pErr, "Empty network.\n" ); return 1; } // get the file name if ( util_optind < argc ) pFileName = argv[util_optind]; else pFileName = Extra_FileNameAppend(pNet->pName, ".cnf"); // write the clauses Ntk_NetworkWriteClauses( pNet, pFileName ); return 0;usage: fprintf( pErr, "usage: _print_clauses <file_name>\n" ); fprintf( pErr, " generates MV SAT clauses for the network\n" ); fprintf( pErr, " <file_name> (optional) the name of the output file.\n" ); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandPrintSat( Mv_Frame_t * pMvsis, int argc, char ** argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; Ntk_Network_t * pNet2; char * pFileNameInput; char * pFileNameOutput; int c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; break; default: goto usage; } } if ( pNet == NULL ) { fprintf( pErr, "Empty network.\n" ); return 1; } // get the file name if ( util_optind >= argc ) { fprintf( pErr, "The second file name is not given.\n" ); goto usage; } // read the second network pFileNameInput = argv[util_optind]; pNet2 = Io_ReadNetwork( pMvsis, pFileNameInput ); // get the output file name if ( util_optind+1 < argc ) pFileNameOutput = argv[util_optind+1]; else { char Buffer[100]; sprintf( Buffer, "%s_%s", pNet->pName, pNet2->pName ); pFileNameOutput = Extra_FileNameAppend(Buffer, ".mvsat"); } Ntk_NetworkWriteSat( pNet, pNet2, pFileNameOutput ); Ntk_NetworkDelete( pNet2 ); return 0;usage: fprintf( pErr, "usage: _print_sat <input_file> <output_file>\n" ); fprintf( pErr, " generates MV SAT clauses to express the non-equivalence\n" ); fprintf( pErr, " of the current network and the network found in <input_file>\n" ); fprintf( pErr, " (currently, this command works only for single-output networks)\n" ); fprintf( pErr, " <output_file> (optional) the name of the output file.\n" ); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandResetName( Mv_Frame_t * pMvsis, int argc, char **argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; int nNodesOld, nNodesNew, c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); // set defaults util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( pNet == NULL ) { fprintf( pErr, "Empty network.\n" ); return 1; } // print nodes by level nNodesOld = pNet->nIds; nNodesNew = Ntk_NetworkCompactNodeIds( pNet ); fprintf( pOut, "The number of node IDs is reduced from %d to %d.\n", nNodesOld, nNodesNew ); return 0;usage: fprintf( pErr, "usage: reset_name [-h]\n" ); fprintf( pErr, "\t compacts node IDs resulting in shorter short names\n" ); fprintf( pErr, "\t-h : print the command usage\n"); return 1;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/int Ntk_CommandRename( Mv_Frame_t * pMvsis, int argc, char **argv ){ FILE * pOut, * pErr; Ntk_Network_t * pNet; int c; pNet = Mv_FrameReadNet(pMvsis); pOut = Mv_FrameReadOut(pMvsis); pErr = Mv_FrameReadErr(pMvsis); // set defaults util_getopt_reset(); while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -