コード例 #1
0
ファイル: modelchecker_smv.cpp プロジェクト: olivo/BP
void modelchecker_smvt::save(
  abstract_modelt &abstract_model,
  unsigned sequence)
{
  std::string out_file_name="satabs."+i2string(sequence)+".smv";

  get_variable_names(abstract_model);
  get_nondet_symbols(abstract_model);
  
  inlined.build(abstract_model);

  threadst threads;
  build_threads(threads);

  std::ofstream out(out_file_name.c_str());
  build_smv_file(abstract_model, threads, out);
}
コード例 #2
0
ファイル: r-recv_model.c プロジェクト: patperry/iproc
static SEXP alloc_term_labels(const struct terms *tm)
{
	SEXP labels;
	size_t ind, len, i, m, n;
	const struct variable *v;

	len = terms_size(tm);
	m = tm->count;

	PROTECT(labels = NEW_STRING(len));
	ind = 0;
	for (i = 0; i < m; i++) {
		v = &tm->item[i];
		n = variable_size(v);
		get_variable_names(v, labels, ind);
		ind += n;
	}
	UNPROTECT(1);

	return labels;
}
コード例 #3
0
ファイル: modelchecker_smv.cpp プロジェクト: olivo/BP
bool modelchecker_smvt::check(
  abstract_modelt &abstract_model,
  abstract_counterexamplet &counterexample)
{
  std::string temp_base="cegar_tmp";

  std::string temp_smv=temp_base+"_abstract.smv";
  std::string temp_smv_out1=temp_base+"_smv_out1";
  std::string temp_smv_out2=temp_base+"_smv_out2";
  std::string temp_smv_out_ce=temp_base+"_abstract.out";
  
  remove(temp_smv_out1.c_str());
  remove(temp_smv_out2.c_str());
  remove(temp_smv_out_ce.c_str());

  get_variable_names(abstract_model);
  get_nondet_symbols(abstract_model);
  
  inlined.build(abstract_model);

  threadst threads;
  build_threads(threads);

  {
    std::ofstream out(temp_smv.c_str());
    build_smv_file(abstract_model, threads, out);
  }

  if(!inlined.has_assertion())
  {
    status("Property holds trivially");
    return true;
  }

  {
    std::string command;

    switch(engine)
    {
    case NUSMV:
      command="NuSMV -f -dynamic";
      status(std::string("Running NuSMV: ")+command);
      break;
      
    case CMU_SMV:
      status(std::string("Running CMU SMV: ")+command);
      command="smv";
      break;

    case CADENCE_SMV:
      command="smv -force -sift";
      status(std::string("Running Cadence SMV: ")+command);
      break;

    case SATMC:
      command="satmc";
      status(std::string("Running SATMC")+command);
      break;
      
    default:
      assert(false);
    }

    command+=" "+temp_smv+" >"+temp_smv_out1+
             " 2>"+temp_smv_out2;

    {
    	print(9, "The full model checker command to be executed is:\n"+command+"\n");
    }

    int return_code = system(command.c_str());
    {
    	std::ostringstream str;
    	str << "Got return code " << return_code << std::endl;
    	print(9, str.str());
    }
  }

  bool result;

  {
    std::ifstream out1(temp_smv_out1.c_str()),
                  out2(temp_smv_out2.c_str()),
                  out_ce(temp_smv_out_ce.c_str());

    result=read_result(
      out1,
      out2,
      out_ce,
      abstract_model, threads,
      counterexample);
  }

  return result;
}