示例#1
0
void update_insn_error_info(const char* boolstr, const char* insn)
{
	if(strcmp(boolstr, "y") == 0)
		get_map_entry(insn)->errorneous = 1;
	else 
		get_map_entry(insn)->errorneous = 0;
}
示例#2
0
boolbv_mapt::map_entryt &boolbv_mapt::get_map_entry(
  const irep_idt &identifier,
  const typet &type)
{
  if(type.id()==ID_symbol)
    return get_map_entry(identifier, ns.follow(type));

  std::pair<mappingt::iterator, bool> result=
    mapping.insert(std::pair<irep_idt, map_entryt>(
      identifier, map_entryt()));

  map_entryt &map_entry=result.first->second;

  if(result.second)
  { // actually inserted
    map_entry.type=type;
    map_entry.width=boolbv_width(type);
    map_entry.bvtype=get_bvtype(type);
    map_entry.literal_map.resize(map_entry.width);
  }

  assert(map_entry.literal_map.size()==map_entry.width);

  return map_entry;
}
  void Radial_Inline_Mesh_Desc::Populate_Coords(Real * coords,
      std::vector<long long> & global_node_vector,
      std::map <long long, long long> & global_node_map,
      long long num_nodes)

    /****************************************************************************/
  {
    Real deg_to_rad = M_PI/180.0;
    Real total_theta = c_block_dist[1][inline_b[1]];
    long long global_ind[3];
    for(unsigned gnv = 0;gnv < global_node_vector.size();gnv ++){
      long long the_node = global_node_vector[gnv];
      global_ind[2] = the_node/knstride;
      global_ind[1] = (the_node-global_ind[2]*knstride)/jnstride;
      global_ind[0] = the_node - global_ind[2]*knstride-global_ind[1]*jnstride;

      long long the_local_node = get_map_entry(global_node_map,the_node);
      coords[the_local_node+0*num_nodes]= IJKcoors[0][global_ind[0]]*cos(IJKcoors[1][global_ind[1]]*deg_to_rad);
      coords[the_local_node+1*num_nodes]= IJKcoors[0][global_ind[0]]*sin(IJKcoors[1][global_ind[1]]*deg_to_rad);
      if(dimension == 3){
        coords[the_local_node+2*num_nodes]= IJKcoors[2][global_ind[2]];
      }

      if(enforce_periodic){
        Vector tv = calc_coords_periodic(total_theta, global_ind[0], global_ind[1], global_ind[2]);
        coords[the_local_node+0*num_nodes]= tv.X();
        coords[the_local_node+1*num_nodes]= tv.Y();
        if(dimension == 3){
          coords[the_local_node+2*num_nodes]= tv.Z();
        }
      }
    }
  }
示例#4
0
literalt boolbv_mapt::get_literal(
  const irep_idt &identifier,
  const unsigned bit,
  const typet &type)
{
  map_entryt &map_entry=get_map_entry(identifier, type);

  assert(bit<map_entry.literal_map.size());
  map_bitt &mb=map_entry.literal_map[bit];

  if(mb.is_set)
    return mb.l;

  literalt l=prop.new_variable();

  mb.is_set=true;
  mb.l=l;

  #ifdef DEBUG
  std::cout << "NEW: " << identifier << ":" << bit
            << "=" << l << std::endl;
  #endif

  return l;
}
示例#5
0
void boolbv_mapt::get_literals(
  const irep_idt &identifier,
  const typet &type,
  const unsigned width,
  bvt &literals)
{
  map_entryt &map_entry=get_map_entry(identifier, type);

  assert(literals.size()==width);
  Forall_literals(it, literals)
  {
    literalt &l=*it;
    const unsigned bit=it-literals.begin();

    assert(bit<map_entry.literal_map.size());
    map_bitt &mb=map_entry.literal_map[bit];

    if(mb.is_set)
    {
      l=mb.l;
      continue;
    }

    l=prop.new_variable();

    mb.is_set=true;
    mb.l=l;

    #ifdef DEBUG
    std::cout << "NEW: " << identifier << ":" << bit
              << "=" << l << std::endl;
    #endif
  }
示例#6
0
uint64_t get_cycle_count(char* instruction)
{
	struct variability_instruction_set* p = get_map_entry(instruction);
	if(p == NULL)
	{
		printf("Illegal instruction sent");
		return 0;
	} else if(p->cycle_count == 0)
		printf("Instruction map not initialized");
	// TODO(gdrane): Put an exception like illegal instruction to get 
	// out of here.
	return p->cycle_count;
}
示例#7
0
void boolbv_mapt::set_literal(
  const irep_idt &identifier,
  const unsigned bit,
  const typet &type,
  literalt literal)
{
  assert(literal.is_constant() ||
         literal.var_no()<prop.no_variables());

  map_entryt &map_entry=get_map_entry(identifier, type);
  assert(bit<map_entry.literal_map.size());

  if(map_entry.literal_map[bit].is_set)
  {
    prop.set_equal(map_entry.literal_map[bit].l, literal);
    return;
  }

  map_entry.literal_map[bit].is_set=true;
  map_entry.literal_map[bit].l=literal;
}
示例#8
0
void update_insn_class_info(const char* class_idx, const char* insn)
{
	// Assuming class indexes are positive
	const QDictEntry* pentry;
	int64_t idx= -1;
	assert(class_info != NULL);
	pentry = qdict_first(class_info);
	do
	{
		QObject* temp = qdict_entry_value(pentry);		
		QDict* pdict = qobject_to_qdict(temp);
		idx = qdict_get_int(pdict, "idx");
		const char * str = qdict_get_str(pdict, "class_name");
		if(strcmp(str, class_idx) == 0)
			break;
		idx = -1;
		pentry = qdict_next(class_info, pentry);
	} while(pentry != NULL);
	assert(insn_map != NULL);
	if(idx != -1)
		get_map_entry(insn)->instruction_type = idx;
}