void SymbLayer_set_name(SymbLayer_ptr self, const char* new_name) { SYMB_LAYER_CHECK_INSTANCE(self); /* frees the previous name if needed */ if (self->name != (char*) NULL) { FREE(self->name); } if (new_name != (char*) NULL) self->name = util_strsav((char*) new_name); else self->name = (char*) NULL; }
void read_cube(register FILE *fp, pPLA PLA) { register int var, i; pset cf = cube.temp[0], cr = cube.temp[1], cd = cube.temp[2]; int savef = 0, saved = 0, saver = 0; char token[256]; int varx, first, last, offset; set_clear(cf, cube.size); for(var = 0; var < cube.num_binary_vars; var++) switch((--(fp)->_cnt>=0? ((int)*(fp)->_ptr++):_filbuf(fp))) { case (-1): goto bad_char; case '\n': if (! line_length_error) fprintf((&_iob[2]), "product term(s) %s\n", "span more than one line (warning only)"); line_length_error = 1; lineno++; var--; break; case ' ': case '|': case '\t': var--; break; case '2': case '-': (cf[((( var*2+1) >> 5) + 1)] |= 1 << (( var*2+1) & (32-1))); case '0': (cf[((( var*2) >> 5) + 1)] |= 1 << (( var*2) & (32-1))); break; case '1': (cf[((( var*2+1) >> 5) + 1)] |= 1 << (( var*2+1) & (32-1))); break; case '?': break; default: goto bad_char; } for(var = cube.num_binary_vars; var < cube.num_vars-1; var++) if (cube.part_size[var] < 0) { (void) fscanf(fp, "%s", token); if ((strcmp(token, "-") == 0) || (strcmp(token, "ANY") == 0)) { if (kiss && var == cube.num_vars - 2) { } else { set_or(cf, cf, cube.var_mask[var]); } } else if ((strcmp(token, "~") == 0)) { ; } else { if (kiss && var == cube.num_vars - 2) varx = var - 1, offset = ((cube.part_size[var-1]) < 0 ? -(cube.part_size[var-1]) : (cube.part_size[var-1])); else varx = var, offset = 0; first = cube.first_part[varx]; last = cube.last_part[varx]; for(i = first; i <= last; i++) if (PLA->label[i] == (char *) 0) { PLA->label[i] = util_strsav(token); (cf[((( i+offset) >> 5) + 1)] |= 1 << (( i+offset) & (32-1))); break; } else if ((strcmp(PLA->label[i], token) == 0)) {
/**Function******************************************************************** Synopsis [Performs a simulation from the current selected state] SideEffects [Generated referenced states traces are stored to be analyzed by the user in a second time] SeeAlso [pick_state goto_state] CommandName [simulate] CommandSynopsis [Performs a simulation from the current selected state] CommandArguments [\[-h\] \[-p | -v\] \[-r | -i \[-a\]\] [\[-c "constraints"\] | \[-t "constraints"\] ] \[-k steps\] ] CommandDescription [ Generates a sequence of at most <tt>steps</tt> states (representing a possible execution of the model), starting from the <em>current state</em>. The current state must be set via the <em>pick_state</em> or <em>goto_state</em> commands.<p> It is possible to run the simulation in three ways (according to different command line policies): deterministic (the default mode), random and interactive.<p> The resulting sequence is stored in a trace indexed with an integer number taking into account the total number of traces stored in the system. There is a different behavior in the way traces are built, according to how <em>current state</em> is set: <em>current state</em> is always put at the beginning of a new trace (so it will contain at most <it>steps + 1</it> states) except when it is the last state of an existent old trace. In this case the old trace is lengthened by at most <it>steps</it> states. <p> Command Options:<p> <dl> <dt> <tt>-p</tt> <dd> Prints current generated trace (only those variables whose value changed from the previous state). <dt> <tt>-v</tt> <dd> Verbosely prints current generated trace (changed and unchanged state variables). <dt> <tt>-r</tt> <dd> Picks a state from a set of possible future states in a random way. <dt> <tt>-i</tt> <dd> Enables the user to interactively choose every state of the trace, step by step. If the number of possible states is too high, then the user has to specify some constraints as simple expression. These constraints are used only for a single simulation step and are <em>forgotten</em> in the following ones. They are to be intended in an opposite way with respect to those constraints eventually entered with the pick_state command, or during an interactive simulation session (when the number of future states to be displayed is too high), that are <em>local</em> only to a single step of the simulation and are <em>forgotten</em> in the next one. <dt> <tt>-a</tt> <dd> Displays all the state variables (changed and unchanged) during every step of an interactive session. This option works only if the <tt>-i</tt> option has been specified. <dt> <tt>-c "constraints"</tt> <dd> Performs a simulation in which computation is restricted to states satisfying those <tt>constraints</tt>. The desired sequence of states could not exist if such constraints were too strong or it may happen that at some point of the simulation a future state satisfying those constraints doesn't exist: in that case a trace with a number of states less than <tt>steps</tt> trace is obtained. The expression cannot contain next operators, and is automatically shifted by one state in order to constraint only the next steps <dt> <tt>-t "constraints"</tt> <dd> Performs a simulation in which computation is restricted to states satisfying those <tt>constraints</tt>. The desired sequence of states could not exist if such constraints were too strong or it may happen that at some point of the simulation a future state satisfying those constraints doesn't exist: in that case a trace with a number of states less than <tt>steps</tt> trace is obtained. The expression can contain next operators, and is NOT automatically shifted by one state as done with option -c <dt> <tt>-k steps</tt> <dd> Maximum length of the path according to the constraints. The length of a trace could contain less than <tt>steps</tt> states: this is the case in which simulation stops in an intermediate step because it may not exist any future state satisfying those constraints. </dl> ] ******************************************************************************/ int CommandSimulate(int argc, char **argv) { BddEnc_ptr enc; DdManager* dd; bdd_ptr bdd_constraints = (bdd_ptr) NULL; boolean isconstraint = false; boolean printrace = false; int display_all = 0; int c = 0; boolean only_changes = 1; boolean time_shift = false; int steps = get_default_simulation_steps(OptsHandler_get_instance()); Simulation_Mode mode = Deterministic; boolean k_specified = false; /* the string of constraint to parsificate */ char* strConstr = NIL(char); util_getopt_reset(); while((c = util_getopt(argc,argv,"t:c:hpvriak:")) != EOF){ switch(c){ case 'h': return UsageSimulate(); case 'p': if (printrace == true) return UsageSimulate(); printrace = true; only_changes = true; break; case 'v': if (printrace == true) return UsageSimulate(); printrace = true; only_changes = false; break; case 'r': if (mode == Interactive) return UsageSimulate(); mode = Random; break; case 'i': if (mode == Random) return UsageSimulate(); mode = Interactive; break; case 'a': display_all = 1; break; case 'c': if (NIL(char) != strConstr) return UsageSimulate(); strConstr = util_strsav(util_optarg); isconstraint = true; time_shift = true; break; case 't': if (NIL(char) != strConstr) return UsageSimulate(); strConstr = util_strsav(util_optarg); isconstraint = true; time_shift = false; break; case 'k': { char* strNumber; if (k_specified) { fprintf(nusmv_stderr, "Option -k cannot be specified more than once.\n"); return 1; } strNumber = util_strsav(util_optarg); if (util_str2int(strNumber, &steps) != 0) { error_invalid_number(strNumber); FREE(strNumber); return 1; } if (steps < 0) { error_invalid_number(strNumber); FREE(strNumber); return 1; } FREE(strNumber); k_specified = true; break; } default: return UsageSimulate(); } } if ((mode != Interactive) && (display_all == 1)) return UsageSimulate(); if (argc == util_optind + 1) { char* strNumber; fprintf(nusmv_stderr, "*** Warning: Parameter \"steps\" is deprecated. " "Use option \"-k\" instead\n"); if (k_specified) { fprintf(nusmv_stderr, "Error: Parameter \"steps\" conflicts with option -k\n"); return 1; } strNumber = util_strsav(argv[util_optind]); if (util_str2int(strNumber, &steps) != 0) { error_invalid_number(strNumber); FREE(strNumber); return 1; } if (steps < 0) { error_invalid_number(strNumber); FREE(strNumber); return 1; } FREE(strNumber); k_specified = true; } else if (argc != util_optind) { return UsageSimulate(); } /* pre-conditions */ if (Compile_check_if_model_was_built(nusmv_stderr, true)) return 1; if (!(current_state_exist())) { fprintf(nusmv_stderr, "No current state set. Use the \"pick_state\" command.\n"); return 1; } enc = Enc_get_bdd_encoding(); dd = BddEnc_get_dd_manager(enc); if (isconstraint == true) { bdd_constraints = simulate_get_constraints_from_string(strConstr, enc, !time_shift, true /*inputs*/); FREE(strConstr); if (bdd_constraints == (bdd_ptr) NULL) return 1; /* error */ } else bdd_constraints = bdd_true(dd); { SexpFsm_ptr sexp_fsm; /* needed for trace lanugage */ sexp_fsm = \ PropDb_master_get_scalar_sexp_fsm(PropPkg_get_prop_database()); node_ptr current_trace = Nil; BddFsm_ptr fsm; TraceLabel curr_lbl; fsm = PropDb_master_get_bdd_fsm(PropPkg_get_prop_database()); curr_lbl = current_state_label_get(); nusmv_assert(curr_lbl != TRACE_LABEL_INVALID); fprintf( nusmv_stdout, "******** Simulation Starting From State %d.%d " " ********\n", TraceLabel_get_trace(curr_lbl) + 1, TraceLabel_get_state(curr_lbl) + 1); /* Important: the simulation ALWAYS starts from the current selected state */ current_trace = Simulate_MultipleSteps(fsm, bdd_constraints, time_shift, mode, steps, display_all); if (current_trace == Nil) { bdd_free(dd, bdd_constraints); return 1; } /* extends and prints the current simulation trace */ simulate_extend_print_curr_trace(enc, current_trace, printrace, only_changes, SexpFsm_get_symbols_list(sexp_fsm)); /* Update the current state. */ { int trace_id; Trace_ptr curr_trace; BddStates curr_state; TraceLabel new_label; trace_id = TraceManager_get_current_trace_number(global_trace_manager); curr_trace = TraceManager_get_trace_at_index(global_trace_manager, trace_id); new_label = TraceLabel_create(trace_id, Trace_get_length(curr_trace)); curr_state = TraceUtils_fetch_as_bdd(curr_trace, Trace_last_iter(curr_trace), TRACE_ITER_SF_VARS, enc); current_state_set(curr_state, new_label); bdd_free(BddEnc_get_dd_manager(enc),curr_state); } walk_dd(dd, bdd_free, current_trace); bdd_free(dd, bdd_constraints); } return 0; } /* Command Simulate */
/**Function******************************************************************** Synopsis [Picks a state from the set of initial states] CommandName [pick_state] CommandSynopsis [Picks a state from the set of initial states] CommandArguments [\[-h\] \[-v\] \[-r | -i \[-a\]\] \[-c "constraints" | -s trace.state\]] CommandDescription [ Chooses an element from the set of initial states, and makes it the <tt>current state</tt> (replacing the old one). The chosen state is stored as the first state of a new trace ready to be lengthened by <tt>steps</tt> states by the <tt>simulate</tt> command. The state can be chosen according to different policies which can be specified via command line options. By default the state is chosen in a deterministic way. <p> Command Options:<p> <dl> <dt> <tt>-v</tt> <dd> Verbosely prints out chosen state (all state variables, otherwise it prints out only the label <tt>t.1</tt> of the state chosen, where <tt>t</tt> is the number of the new trace, that is the number of traces so far generated plus one). <dt> <tt>-r</tt> <dd> Randomly picks a state from the set of initial states. <dt> <tt>-i</tt> <dd> Enables the user to interactively pick up an initial state. The user is requested to choose a state from a list of possible items (every item in the list doesn't show state variables unchanged with respect to a previous item). If the number of possible states is too high, then the user has to specify some further constraints as "simple expression". <dt> <tt>-a</tt> <dd> Displays all state variables (changed and unchanged with respect to a previous item) in an interactive picking. This option works only if the <tt>-i</tt> options has been specified. <dt> <tt>-c "constraints"</tt> <dd> Uses <tt>constraints</tt> to restrict the set of initial states in which the state has to be picked. <dt> <tt>-s trace.state</tt> <dd> Picks state from trace.state label. A new simulation trace will be created by copying prefix of the source trace up to specified state. </dl> ] SideEffects [The state chosen is stored in the traces_hash table as the first state of a new trace] SeeAlso [goto_state simulate] ******************************************************************************/ int CommandPickState(int argc, char ** argv) { int res = 1; int c = 0; boolean verbose = false; int display_all = 0; char *strConstr = NIL(char); char *strLabel = NIL(char); Simulation_Mode mode = Deterministic; short int usedMode = 0; TraceManager_ptr gtm = TracePkg_get_global_trace_manager(); int tr_number; util_getopt_reset(); while ((c = util_getopt(argc, argv, "hriavc:s:")) != EOF) { switch(c){ case 'h': return UsagePickState(); case 'r': if (++usedMode > 1) goto simulate_cmd_pick_state_usage; mode = Random; break; case 'i': if (++usedMode > 1) goto simulate_cmd_pick_state_usage; mode = Interactive; break; case 'a': display_all = 1; break; case 'v': verbose = true; break; case 'c': strConstr = util_strsav(util_optarg); break; case 's': strLabel = util_strsav(util_optarg); break; default: goto simulate_cmd_pick_state_usage; } } if ((mode != Interactive) && (display_all == 1)) goto simulate_cmd_pick_state_usage; if (argc != util_optind) goto simulate_cmd_pick_state_usage; /* pre-conditions */ if (Compile_check_if_model_was_built(nusmv_stderr, true)) goto simulate_cmd_pick_state_free; if (strLabel != (char*) NULL) { TraceLabel label; if (strConstr != (char*) NULL) { fprintf(nusmv_stderr, "Options -c and -s cannot be used at the same time\n"); res = 1; goto simulate_cmd_pick_state_free; } label = TraceLabel_create_from_string(strLabel); if (label == TRACE_LABEL_INVALID || \ !TraceManager_is_label_valid(gtm, label)) { fprintf(nusmv_stderr, "Label \"%s\" is invalid\n", strLabel); res = 1; goto simulate_cmd_pick_state_free; } { /* constructs a new trace from given label */ Trace_ptr from_trace = \ TraceManager_get_trace_at_index(gtm, TraceLabel_get_trace(label)); TraceIter iter = TraceManager_get_iterator_from_label(gtm, label); Trace_ptr new_trace = TRACE(NULL); bdd_ptr state; TraceLabel new_label; BddEnc_ptr enc = Enc_get_bdd_encoding(); /* create new simulation trace from previous one */ new_trace = Trace_copy(from_trace, iter, false); Trace_set_desc(new_trace, "Simulation Trace"); Trace_set_type(new_trace, TRACE_TYPE_SIMULATION); tr_number = TraceManager_register_trace(gtm, new_trace); TraceManager_set_current_trace_number(gtm, tr_number); /* Now the new label we get would be the label of the next * trace that is going to be registered. */ new_label = TraceLabel_create( TraceManager_get_size(gtm), TraceManager_get_abs_index_from_label(gtm, label)); state = TraceUtils_fetch_as_bdd(from_trace, iter, TRACE_ITER_SF_VARS, enc); current_state_set(state, new_label); } } else { tr_number = Simulate_CmdPickOneState(PropDb_master_get_bdd_fsm( PropPkg_get_prop_database()), mode, display_all, strConstr); } /* results presentation */ if (tr_number != -1) { if (verbose) { TraceManager_execute_plugin(gtm, TRACE_OPT(NULL), TRACE_MANAGER_DEFAULT_PLUGIN, TRACE_MANAGER_LAST_TRACE); } /* Everything went ok */ res = 0; } else { if ((char*) NULL == strConstr) { fprintf(nusmv_stderr, "No trace: initial state is inconsistent\n"); } else { fprintf(nusmv_stderr, "No trace: constraint and initial state are inconsistent\n"); } res = 1; } goto simulate_cmd_pick_state_free; simulate_cmd_pick_state_usage: res = UsagePickState(); simulate_cmd_pick_state_free: if (NIL(char) != strLabel) { FREE(strLabel); } if (NIL(char) != strConstr) { FREE(strConstr); } return res; }
void TraceOpt_set_hiding_prefix(TraceOpt_ptr self, const char* hiding_prefix) { TRACE_OPT_CHECK_INSTANCE(self); self->hiding_prefix = util_strsav(hiding_prefix); }
/**Function******************************************************************** Synopsis [Reads the command line options.] Description [Reads the command line options. Scans the command line one argument at a time and performs a switch on each arguement it hits. Some arguemnts also read in the following arg from the list (i.e., -f also gets the filename which should folow.) Gives a usage message and exits if any unrecognized args are found.] SideEffects [May initialize the random number generator.] SeeAlso [mainInit ntrReadOptionsFile] ******************************************************************************/ static void ntrReadOptions( int argc, char ** argv, NtrOptions * option) { int i = 0; if (argc < 2) goto usage; if (STRING_EQUAL(argv[1],"-f")) { ntrReadOptionsFile(argv[2],&argv,&argc); } for (i = 1; i < argc; i++) { if (argv[i][0] != '-' ) { if (option->file1 == NULL) { option->file1 = util_strsav(argv[i]); } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-second")) { i++; option->file2 = util_strsav(argv[i]); option->second = TRUE; } else if (STRING_EQUAL(argv[i],"-verify")) { i++; option->file2 = util_strsav(argv[i]); option->verify = TRUE; } else if (STRING_EQUAL(argv[i],"-trav")) { option->traverse = TRUE; } else if (STRING_EQUAL(argv[i],"-depend")) { option->traverse = TRUE; option->depend = TRUE; } else if (STRING_EQUAL(argv[i],"-image")) { i++; if (STRING_EQUAL(argv[i],"part")) { option->image = NTR_IMAGE_PART; } else if (STRING_EQUAL(argv[i],"clip")) { option->image = NTR_IMAGE_CLIP; } else if (STRING_EQUAL(argv[i],"depend")) { option->image = NTR_IMAGE_DEPEND; } else if (STRING_EQUAL(argv[i],"mono")) { option->image = NTR_IMAGE_MONO; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-depth")) { i++; option->imageClip = (double) atof(argv[i]); } else if (STRING_EQUAL(argv[i],"-cdepth")) { i++; option->closureClip = (double) atof(argv[i]); } else if (STRING_EQUAL(argv[i],"-approx")) { i++; if (STRING_EQUAL(argv[i],"under")) { option->approx = NTR_UNDER_APPROX; } else if (STRING_EQUAL(argv[i],"over")) { option->approx = NTR_OVER_APPROX; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-threshold")) { i++; option->threshold = (int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-from")) { i++; if (STRING_EQUAL(argv[i],"new")) { option->from = NTR_FROM_NEW; } else if (STRING_EQUAL(argv[i],"reached")) { option->from = NTR_FROM_REACHED; } else if (STRING_EQUAL(argv[i],"restrict")) { option->from = NTR_FROM_RESTRICT; } else if (STRING_EQUAL(argv[i],"compact")) { option->from = NTR_FROM_COMPACT; } else if (STRING_EQUAL(argv[i],"squeeze")) { option->from = NTR_FROM_SQUEEZE; } else if (STRING_EQUAL(argv[i],"subset")) { option->from = NTR_FROM_UNDERAPPROX; } else if (STRING_EQUAL(argv[i],"superset")) { option->from = NTR_FROM_OVERAPPROX; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-groupnsps")) { i++; if (STRING_EQUAL(argv[i],"none")) { option->groupnsps = NTR_GROUP_NONE; } else if (STRING_EQUAL(argv[i],"default")) { option->groupnsps = NTR_GROUP_DEFAULT; } else if (STRING_EQUAL(argv[i],"fixed")) { option->groupnsps = NTR_GROUP_FIXED; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-closure")) { option->closure = TRUE; } else if (STRING_EQUAL(argv[i],"-envelope")) { option->envelope = TRUE; } else if (STRING_EQUAL(argv[i],"-scc")) { option->scc = TRUE; } else if (STRING_EQUAL(argv[i],"-maxflow")) { option->maxflow = TRUE; } else if (STRING_EQUAL(argv[i],"-shortpaths")) { i++; if (STRING_EQUAL(argv[i],"none")) { option->shortPath = NTR_SHORT_NONE; } else if (STRING_EQUAL(argv[i],"bellman")) { option->shortPath = NTR_SHORT_BELLMAN; } else if (STRING_EQUAL(argv[i],"floyd")) { option->shortPath = NTR_SHORT_FLOYD; } else if (STRING_EQUAL(argv[i],"square")) { option->shortPath = NTR_SHORT_SQUARE; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-selective")) { option->selectiveTrace = TRUE; } else if (STRING_EQUAL(argv[i],"-zdd")) { option->zddtest = TRUE; } else if (STRING_EQUAL(argv[i],"-cover")) { option->zddtest = TRUE; option->printcover = TRUE; } else if (STRING_EQUAL(argv[i],"-sink")) { i++; option->maxflow = TRUE; option->sinkfile = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-part")) { option->partition = TRUE; } else if (STRING_EQUAL(argv[i],"-char2vect")) { option->char2vect = TRUE; } else if (STRING_EQUAL(argv[i],"-density")) { option->density = TRUE; } else if (STRING_EQUAL(argv[i],"-quality")) { i++; option->quality = (double) atof(argv[i]); } else if (STRING_EQUAL(argv[i],"-decomp")) { option->decomp = TRUE; } else if (STRING_EQUAL(argv[i],"-cofest")) { option->cofest = TRUE; } else if (STRING_EQUAL(argv[i],"-clip")) { i++; option->clip = (double) atof(argv[i]); i++; option->file2 = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-dctest")) { option->dontcares = TRUE; i++; option->file2 = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-closest")) { option->closestCube = TRUE; } else if (STRING_EQUAL(argv[i],"-clauses")) { option->clauses = TRUE; } else if (STRING_EQUAL(argv[i],"-nobuild")) { option->noBuild = TRUE; option->reordering = CUDD_REORDER_NONE; } else if (STRING_EQUAL(argv[i],"-delta")) { option->stateOnly = TRUE; } else if (STRING_EQUAL(argv[i],"-node")) { i++; option->node = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-local")) { option->locGlob = BNET_LOCAL_DD; } else if (STRING_EQUAL(argv[i],"-progress")) { option->progress = TRUE; } else if (STRING_EQUAL(argv[i],"-cache")) { i++; option->cacheSize = (int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-maxmem")) { i++; option->maxMemory = 1048576 * (int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-memhard")) { i++; option->maxMemHard = 1048576 * (int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-maxlive")) { i++; option->maxLive = (unsigned int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-slots")) { i++; option->slots = (int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-ordering")) { i++; if (STRING_EQUAL(argv[i],"dfs")) { option->ordering = PI_PS_DFS; } else if (STRING_EQUAL(argv[i],"hw")) { option->ordering = PI_PS_FROM_FILE; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-order")) { i++; option->ordering = PI_PS_GIVEN; option->orderPiPs = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-reordering")) { i++; if (STRING_EQUAL(argv[i],"none")) { option->reordering = CUDD_REORDER_NONE; } else if (STRING_EQUAL(argv[i],"random")) { option->reordering = CUDD_REORDER_RANDOM; } else if (STRING_EQUAL(argv[i],"bernard") || STRING_EQUAL(argv[i],"pivot")) { option->reordering = CUDD_REORDER_RANDOM_PIVOT; } else if (STRING_EQUAL(argv[i],"sifting")) { option->reordering = CUDD_REORDER_SIFT; } else if (STRING_EQUAL(argv[i],"converge")) { option->reordering = CUDD_REORDER_SIFT_CONVERGE; } else if (STRING_EQUAL(argv[i],"symm")) { option->reordering = CUDD_REORDER_SYMM_SIFT; } else if (STRING_EQUAL(argv[i],"cosymm")) { option->reordering = CUDD_REORDER_SYMM_SIFT_CONV; } else if (STRING_EQUAL(argv[i],"tree") || STRING_EQUAL(argv[i],"group")) { option->reordering = CUDD_REORDER_GROUP_SIFT; } else if (STRING_EQUAL(argv[i],"cotree") || STRING_EQUAL(argv[i],"cogroup")) { option->reordering = CUDD_REORDER_GROUP_SIFT_CONV; } else if (STRING_EQUAL(argv[i],"win2")) { option->reordering = CUDD_REORDER_WINDOW2; } else if (STRING_EQUAL(argv[i],"win3")) { option->reordering = CUDD_REORDER_WINDOW3; } else if (STRING_EQUAL(argv[i],"win4")) { option->reordering = CUDD_REORDER_WINDOW4; } else if (STRING_EQUAL(argv[i],"win2conv")) { option->reordering = CUDD_REORDER_WINDOW2_CONV; } else if (STRING_EQUAL(argv[i],"win3conv")) { option->reordering = CUDD_REORDER_WINDOW3_CONV; } else if (STRING_EQUAL(argv[i],"win4conv")) { option->reordering = CUDD_REORDER_WINDOW4_CONV; } else if (STRING_EQUAL(argv[i],"annealing")) { option->reordering = CUDD_REORDER_ANNEALING; } else if (STRING_EQUAL(argv[i],"genetic")) { option->reordering = CUDD_REORDER_GENETIC; } else if (STRING_EQUAL(argv[i],"linear")) { option->reordering = CUDD_REORDER_LINEAR; } else if (STRING_EQUAL(argv[i],"linconv")) { option->reordering = CUDD_REORDER_LINEAR_CONVERGE; } else if (STRING_EQUAL(argv[i],"exact")) { option->reordering = CUDD_REORDER_EXACT; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-autodyn")) { option->autoDyn = 3; } else if (STRING_EQUAL(argv[i],"-autodynB")) { option->autoDyn |= 1; } else if (STRING_EQUAL(argv[i],"-autodynZ")) { option->autoDyn |= 2; } else if (STRING_EQUAL(argv[i],"-automethod")) { i++; if (STRING_EQUAL(argv[i],"none")) { option->autoMethod = CUDD_REORDER_NONE; } else if (STRING_EQUAL(argv[i],"random")) { option->autoMethod = CUDD_REORDER_RANDOM; } else if (STRING_EQUAL(argv[i],"bernard") || STRING_EQUAL(argv[i],"pivot")) { option->autoMethod = CUDD_REORDER_RANDOM_PIVOT; } else if (STRING_EQUAL(argv[i],"sifting")) { option->autoMethod = CUDD_REORDER_SIFT; } else if (STRING_EQUAL(argv[i],"converge")) { option->autoMethod = CUDD_REORDER_SIFT_CONVERGE; } else if (STRING_EQUAL(argv[i],"symm")) { option->autoMethod = CUDD_REORDER_SYMM_SIFT; } else if (STRING_EQUAL(argv[i],"cosymm")) { option->autoMethod = CUDD_REORDER_SYMM_SIFT_CONV; } else if (STRING_EQUAL(argv[i],"tree") || STRING_EQUAL(argv[i],"group")) { option->autoMethod = CUDD_REORDER_GROUP_SIFT; } else if (STRING_EQUAL(argv[i],"cotree") || STRING_EQUAL(argv[i],"cogroup")) { option->autoMethod = CUDD_REORDER_GROUP_SIFT_CONV; } else if (STRING_EQUAL(argv[i],"win2")) { option->autoMethod = CUDD_REORDER_WINDOW2; } else if (STRING_EQUAL(argv[i],"win3")) { option->autoMethod = CUDD_REORDER_WINDOW3; } else if (STRING_EQUAL(argv[i],"win4")) { option->autoMethod = CUDD_REORDER_WINDOW4; } else if (STRING_EQUAL(argv[i],"win2conv")) { option->autoMethod = CUDD_REORDER_WINDOW2_CONV; } else if (STRING_EQUAL(argv[i],"win3conv")) { option->autoMethod = CUDD_REORDER_WINDOW3_CONV; } else if (STRING_EQUAL(argv[i],"win4conv")) { option->autoMethod = CUDD_REORDER_WINDOW4_CONV; } else if (STRING_EQUAL(argv[i],"annealing")) { option->autoMethod = CUDD_REORDER_ANNEALING; } else if (STRING_EQUAL(argv[i],"genetic")) { option->autoMethod = CUDD_REORDER_GENETIC; } else if (STRING_EQUAL(argv[i],"linear")) { option->autoMethod = CUDD_REORDER_LINEAR; } else if (STRING_EQUAL(argv[i],"linconv")) { option->autoMethod = CUDD_REORDER_LINEAR_CONVERGE; } else if (STRING_EQUAL(argv[i],"exact")) { option->autoMethod = CUDD_REORDER_EXACT; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-tree")) { i++; option->treefile = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-first")) { i++; option->firstReorder = (int)atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-countdead")) { option->countDead = TRUE; } else if (STRING_EQUAL(argv[i],"-growth")) { i++; option->maxGrowth = (int)atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-groupcheck")) { i++; if (STRING_EQUAL(argv[i],"check")) { option->groupcheck = CUDD_GROUP_CHECK; } else if (STRING_EQUAL(argv[i],"nocheck")) { option->groupcheck = CUDD_NO_CHECK; } else if (STRING_EQUAL(argv[i],"check2")) { option->groupcheck = CUDD_GROUP_CHECK2; } else if (STRING_EQUAL(argv[i],"check3")) { option->groupcheck = CUDD_GROUP_CHECK3; } else if (STRING_EQUAL(argv[i],"check4")) { option->groupcheck = CUDD_GROUP_CHECK4; } else if (STRING_EQUAL(argv[i],"check5")) { option->groupcheck = CUDD_GROUP_CHECK5; } else if (STRING_EQUAL(argv[i],"check6")) { option->groupcheck = CUDD_GROUP_CHECK6; } else if (STRING_EQUAL(argv[i],"check7")) { option->groupcheck = CUDD_GROUP_CHECK7; } else if (STRING_EQUAL(argv[i],"check8")) { option->groupcheck = CUDD_GROUP_CHECK8; } else if (STRING_EQUAL(argv[i],"check9")) { option->groupcheck = CUDD_GROUP_CHECK9; } else { goto usage; } } else if (STRING_EQUAL(argv[i],"-arcviolation")) { i++; option->arcviolation = (int)atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-symmviolation")) { i++; option->symmviolation = (int)atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-recomb")) { i++; option->recomb = (int)atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-drop")) { option->nodrop = FALSE; } else if (STRING_EQUAL(argv[i],"-sign")) { option->signatures = TRUE; } else if (STRING_EQUAL(argv[i],"-genetic")) { option->gaOnOff = 1; } else if (STRING_EQUAL(argv[i],"-genepop")) { option->gaOnOff = 1; i++; option->populationSize = (int)atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-genexover")) { option->gaOnOff = 1; i++; option->numberXovers = (int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-seed")) { i++; Cudd_Srandom((long)atoi(argv[i])); } else if (STRING_EQUAL(argv[i],"-dumpfile")) { i++; option->bdddump = TRUE; option->dumpfile = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-dumpblif")) { option->dumpFmt = 1; /* blif */ } else if (STRING_EQUAL(argv[i],"-dumpdaVinci")) { option->dumpFmt = 2; /* daVinci */ } else if (STRING_EQUAL(argv[i],"-dumpddcal")) { option->dumpFmt = 3; /* DDcal */ } else if (STRING_EQUAL(argv[i],"-dumpfact")) { option->dumpFmt = 4; /* factored form */ } else if (STRING_EQUAL(argv[i],"-store")) { i++; option->store = (int) atoi(argv[i]); } else if (STRING_EQUAL(argv[i],"-storefile")) { i++; option->storefile = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-loadfile")) { i++; option->load = 1; option->loadfile = util_strsav(argv[i]); } else if (STRING_EQUAL(argv[i],"-p")) { i++; option->verb = (int) atoi(argv[i]); } else { goto usage; } } if (option->store >= 0 && option->storefile == NULL) { (void) fprintf(stdout,"-storefile mandatory with -store\n"); exit(-1); } if (option->verb >= 0) { (void) printf("# %s\n", NTR_VERSION); /* echo command line and arguments */ (void) printf("#"); for (i = 0; i < argc; i++) { (void) printf(" %s", argv[i]); } (void) printf("\n"); (void) printf("# CUDD Version "); Cudd_PrintVersion(stdout); (void) fflush(stdout); } return; usage: /* convenient goto */ printf("Usage: please read man page\n"); if (i == 0) { (void) fprintf(stdout,"too few arguments\n"); } else { (void) fprintf(stdout,"option: %s is not defined\n",argv[i]); } exit(-1); } /* end of ntrReadOptions */