Beispiel #1
0
/* Return NULL if failed */
Symmetry * sym_get_operation(SPGCONST Cell * primitive,
			     const double symprec)
{

  debug_print("sym_get_operations:\n");

  return get_operations(primitive, symprec, angle_tolerance);
}
Beispiel #2
0
Symmetry * sym_get_operation(SPGCONST Cell *cell,
			     const double symprec) {
  Symmetry *symmetry;
  
  symmetry = get_operations(cell, symprec);

  return symmetry;
}
void Gobby::TaskExportHtml::on_response(int response_id)
{
	if(response_id == Gtk::RESPONSE_ACCEPT)
	{
		get_operations().export_html(
			*m_view, m_file_dialog.get_file());
	}

	finish();
}
Beispiel #4
0
void Gobby::TaskOpenMultiple::on_location_response(int response_id)
{
	if(response_id == Gtk::RESPONSE_ACCEPT)
	{
		DocumentLocationDialog& dialog =
			get_document_location_dialog();

		InfBrowserIter iter;
		InfBrowser* browser = dialog.get_selected_directory(&iter);
		g_assert(browser != NULL);

		OperationOpenMultiple* operation =
			get_operations().create_documents(
				browser, &iter,
				get_preferences(), m_files);
	}

	finish();
}
int preprocess_get_line ( char read_in_line [], char label [] , char instruction [] ){

	/************************************************
		process lines
	************************************************/
	int a = 0;
	int * check_mark = &a;

	// printf("00#%s#", read_in_line);

	// 1. remove comment, semicolom, and empty line
	read_in_line = get_line_before_semicol(read_in_line, check_mark);
	// printf("label#%s#  instruction#%s#\n", label, instruction);
	// printf("1 #%s#\n\n", read_in_line);

	// 2. detect label 
	read_in_line = get_label_instruction(read_in_line, label);
	// printf("label#%s#  instruction#%s#\n", label, instruction);
	// printf("2 #%s#\n\n", read_in_line);

	// 3. find mnemonic
	read_in_line = get_mnemonic(read_in_line, instruction);
	// printf("label#%s#  instruction#%s#\n", label, instruction);
	// printf("3 #%s#\n\n", read_in_line);

	// 4. find quotation
	read_in_line = get_quotation(read_in_line, instruction);
	// printf("label#%s#  instruction#%s#\n", label, instruction);
	// printf("4 #%s#\n\n", read_in_line);

	// 5. put rest segments together, one comma is also a segment
	read_in_line = get_operations(read_in_line, instruction);
	// printf("label#%s#  instruction#%s#\n", label, instruction);

	print_output_line(label, instruction);

	return * check_mark;
}
Beispiel #6
0
void Gobby::TaskSaveAll::process_current()
{
	m_task.reset(NULL);

	if(m_current == m_views.end())
	{
		finish();
	}
	else
	{
		TextSessionView& view = **m_current;

		const DocumentInfoStorage::Info* info =
			get_document_info_storage().get_info(
				view.get_info_storage_key());

		if(info != NULL && !info->uri.empty())
		{
			Glib::RefPtr<Gio::File> file =
				Gio::File::create_for_uri(info->uri);
			get_operations().save_document(
				view, file,
				info->encoding, info->eol_style);

			m_current = m_views.erase(m_current);
			process_current();
		}
		else
		{
			m_task.reset(new TaskSave(m_file_commands, view));

			m_task->signal_finished().connect(sigc::mem_fun(
				*this, &TaskSaveAll::on_finished));
			m_task->run();
		}
	}
}
DesignFlowStep_Status FixCharacterization::Exec()
{
   const auto libraries = TM->get_library_list();
   for(const auto library : libraries)
   {
      const auto LM = TM->get_library_manager(library);
      const auto fus = LM->get_library_fu();
      for(const auto fu : fus)
      {
         INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->Analyzing " + fu.first);
         auto single_fu = GetPointer<functional_unit>(fu.second);
         if(!single_fu) continue;
         auto template_name = single_fu->fu_template_name;
         auto fu_name = single_fu->functional_unit_name;
         if(single_fu)
         {
            ///assignment
            if(fu_name == "ASSIGN_REAL_FU" ||
               fu_name == "ASSIGN_SIGNED_FU" ||
               fu_name == "ASSIGN_UNSIGNED_FU" ||
               fu_name == "ASSIGN_VECTOR_BOOL_FU"
                    )
            {
               single_fu->area_m->set_area_value(1);
               for(auto op : single_fu->get_operations())
               {
                  if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                  {
                     INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                     (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                     single_fu->characterization_timestamp = assignment_characterization_timestamp;
                  }
               }
            }
            /// shift ops
            if(template_name == "rshift_expr_FU" ||
               template_name == "ui_rshift_expr_FU" ||
               template_name == "lshift_expr_FU" ||
               template_name == "ui_lshift_expr_FU" ||
               template_name == "ui_lrotate_expr_FU" ||
               template_name == "ui_rrotate_expr_FU"
                    )
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               THROW_ASSERT(template_parameters.size() == 3, single_fu->fu_template_parameters);
               if(template_parameters[1] == "0")
               {
                  single_fu->area_m->set_area_value(1);
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                        single_fu->characterization_timestamp = assignment_characterization_timestamp;
                     }
                  }
               }
            }
            /// vectorize shift ops
            if(template_name == "vec1_rshift_expr_FU" ||
               template_name == "ui_vec1_rshift_expr_FU" ||
               template_name == "vec1_lshift_expr_FU" ||
               template_name == "ui_vec1_rshift_expr_FU" ||
               template_name == "vec_rshift_expr_FU" ||
               template_name == "ui_vec_rshift_expr_FU" ||
               template_name == "vec_lshift_expr_FU" ||
               template_name == "ui_vec_rshift_expr_FU"
                    )
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               THROW_ASSERT(template_parameters.size() >= 4, single_fu->fu_template_parameters);
               if(template_parameters[2] == "0")
               {
                  single_fu->area_m->set_area_value(1);
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                        single_fu->characterization_timestamp = assignment_characterization_timestamp;
                     }
                  }
               }
            }
            ///conversion
            if(fu_name == "IIdata_converter_FU" ||
               fu_name == "UIdata_converter_FU" ||
               fu_name == "IUdata_converter_FU" ||
               fu_name == "UUdata_converter_FU" ||
               fu_name == "IIconvert_expr_FU" ||
               fu_name == "IUconvert_expr_FU" ||
               fu_name == "UIconvert_expr_FU" ||
               fu_name == "UUconvert_expr_FU"
                    )
            {
               single_fu->area_m->set_area_value(1);
               for(auto op : single_fu->get_operations())
               {
                  if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                  {
                     INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                     (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                     single_fu->characterization_timestamp = assignment_characterization_timestamp;
                  }
               }
            }
            /// bitwise ops
            if(template_name == "bit_and_expr_FU" ||
               template_name == "ui_bit_and_expr_FU" ||
               template_name == "bit_ior_expr_FU" ||
               template_name == "ui_bit_ior_expr_FU"
                    )
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               THROW_ASSERT(template_parameters.size() == 3, single_fu->fu_template_parameters);
               if(template_parameters[0] == "0" || template_parameters[1] == "0")
               {
                  single_fu->area_m->set_area_value(1);
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                        single_fu->characterization_timestamp = assignment_characterization_timestamp;
                     }
                  }
               }
            }
            /// vectorize bitwise ops
            if(template_name == "vec_bit_and_expr_FU" ||
               template_name == "ui_vec_bit_and_expr_FU" ||
               template_name == "vec_bit_ior_expr_FU" ||
               template_name == "ui_vec_bit_ior_expr_FU"
                    )
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               THROW_ASSERT(template_parameters.size() >= 5, single_fu->fu_template_parameters);
               if(template_parameters[0] == "0" || template_parameters[2] == "0")
               {
                  single_fu->area_m->set_area_value(1);
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                        single_fu->characterization_timestamp = assignment_characterization_timestamp;
                     }
                  }
               }
            }
            /// cond expr ops
            if(template_name == "cond_expr_FU" ||
               template_name == "ui_cond_expr_FU" ||
               template_name == "fp_cond_expr_FU"
                    )
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               THROW_ASSERT(template_parameters.size() == 4, single_fu->fu_template_parameters);
               if(template_parameters[0] == "0")
               {
                  single_fu->area_m->set_area_value(1);
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                        single_fu->characterization_timestamp = assignment_characterization_timestamp;
                     }
                  }
               }
            }
            /// vectorize cond expr ops
            if(template_name == "vec_cond_expr_FU" ||
               template_name == "ui_vec_cond_expr_FU"
                    )
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               THROW_ASSERT(template_parameters.size() >= 6, single_fu->fu_template_parameters);
               if(template_parameters[0] == "0")
               {
                  single_fu->area_m->set_area_value(1);
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(assignment_execution_time,0);
                        single_fu->characterization_timestamp = assignment_characterization_timestamp;
                     }
                  }
               }
            }
#if 0
            ///64 bits plus/minus
            if(template_name == "plus_expr_FU" or template_name == "ui_plus_expr_FU" or template_name == "minus_expr_FU" or template_name == "ui_minus_expr_FU")
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               const auto output_size = boost::lexical_cast<size_t>(template_parameters.back());
               ///Strictly larger than 32 (i.e., not 32)
               if(output_size > 32)
               {
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(GetPointer<operation>(op)->time_m->get_execution_time() + connection_time ,0);
                     }
                  }
               }
            }
            ///64 bits ternary
            if(template_name == "ternary_alu_expr_FU" or template_name == "ui_ternary_alu_expr_FU" or template_name == "ternary_mm_expr_FU" or template_name == "ui_ternary_mm_expr_FU" or template_name == "ternary_mp_expr_FU" or template_name == "ui_ternary_mp_expr_FU" or template_name == "ternary_pm_expr_FU" or template_name == "ui_ternary_pm_expr_FU" or template_name == "ternary_plus_expr_FU" or template_name == "ui_ternary_plus_expr_FU")
            {
               std::vector<std::string> template_parameters;
               boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
               const auto output_size = boost::lexical_cast<size_t>(template_parameters.back());
               ///Strictly larger than 32 (i.e., not 32)
               if(output_size > 32)
               {
                  for(auto op : single_fu->get_operations())
                  {
                     if(assignment_execution_time != (GetPointer<operation>(op))->time_m->get_execution_time())
                     {
                        INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Fixing execution time of " + GetPointer<const operation>(op)->operation_name + " on " + fu.first);
                        (GetPointer<operation>(op))->time_m->set_execution_time(GetPointer<operation>(op)->time_m->get_execution_time() + connection_time ,0);
                     }
                  }
               }
            }
#endif
         }

         INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Analyzed " + fu.first);
      }
   }
   ///Second iteration of fixing
   for(const auto library : libraries)
   {
      const auto LM = TM->get_library_manager(library);
      const auto fus = LM->get_library_fu();
      for(const auto fu : fus)
      {
         INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->Analyzing " + fu.first);
         auto single_fu = GetPointer<functional_unit>(fu.second);
         if(!single_fu)
            continue;
         auto template_name = single_fu->fu_template_name;
         if(single_fu)
         {
            ///64 bits plus/minus
            if(template_name == "plus_expr_FU" or template_name == "ui_plus_expr_FU" or template_name == "minus_expr_FU" or template_name == "ui_minus_expr_FU" or template_name == "ui_minus_expr_FU" or template_name == "ternary_alu_expr_FU" or template_name == "ui_ternary_alu_expr_FU" or template_name == "ternary_mm_expr_FU" or template_name == "ui_ternary_mm_expr_FU" or template_name == "ternary_mp_expr_FU" or template_name == "ui_ternary_mp_expr_FU" or template_name == "ternary_pm_expr_FU" or template_name == "ui_ternary_pm_expr_FU" or template_name == "ternary_plus_expr_FU" or template_name == "ui_ternary_plus_expr_FU")
            {
               if(single_fu->fu_template_parameters.find(" 0") != std::string::npos or (single_fu->fu_template_parameters.size() >= 2 and single_fu->fu_template_parameters.substr(0, 2) == "0 "))
               {
                  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "-->Fixing " + single_fu->get_name());
                  std::vector<std::string> template_parameters;
                  boost::algorithm::split(template_parameters, single_fu->fu_template_parameters, boost::algorithm::is_any_of(" "));
                  const auto output_size = boost::lexical_cast<size_t>(template_parameters.back());
                  std::string cell_name = template_name;
                  for(const auto template_parameter : template_parameters)
                  {
                     cell_name += "_";
                     if(template_parameter == "0")
                     {
                        cell_name += STR(output_size);
                     }
                     else
                     {
                        cell_name += template_parameter;
                     }
                  }
                  const technology_nodeConstRef nc_f_unit = TM->get_fu(cell_name, TM->get_library(cell_name));
                  THROW_ASSERT(nc_f_unit, "Library miss component: " + std::string(cell_name));
                  CustomMap<std::string, double> non_constant_execution_times;
                  for(const auto op : GetPointer<const functional_unit>(nc_f_unit)->get_operations())
                  {
                     non_constant_execution_times[op->get_name()] = GetPointer<operation>(op)->time_m->get_execution_time();
                  }
                  for(const auto op : single_fu->get_operations())
                  {
                     const std::string operation_name = op->get_name();
                     THROW_ASSERT(non_constant_execution_times.find(operation_name) != non_constant_execution_times.end(), operation_name);
                     const auto non_constant_execution_time = non_constant_execution_times.find(operation_name)->second;
                     GetPointer<operation>(op)->time_m->set_execution_time(non_constant_execution_time, 0);
                  }
                  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Fixed " + single_fu->get_name());
               }
            }
         }
         INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Analyzed " + fu.first);
      }
   }
   return DesignFlowStep_Status::SUCCESS;
}