libopenfpga/libarchopenfpga/src/read_xml_simulation_setting.cpp
/********************************************************************
 * Parse XML codes of a <clock_setting> to an object of simulation setting
 *******************************************************************/
Parse XML codes of a  to an object of simulation setting
Parse XML codes of a to an object of simulation setting
static 
void read_xml_clock_setting(pugi::xml_node& xml_clock_setting,
                            const pugiutil::loc_data& loc_data,
                            openfpga::SimulationSetting& sim_setting) {
  pugi::xml_node xml_operating_clock_setting = get_single_child(xml_clock_setting, "operating", loc_data);
  sim_setting.set_default_operating_clock_frequency(get_attribute(xml_operating_clock_setting, "frequency", loc_data).as_float(0.));
  std::string num_cycles_str = get_attribute(xml_operating_clock_setting, "num_cycles", loc_data).as_string();
  if (std::string("auto") == num_cycles_str) {
    sim_setting.set_num_clock_cycles(0);
  } else if (0 < get_attribute(xml_operating_clock_setting, "num_cycles", loc_data).as_int(0.)) {
    sim_setting.set_num_clock_cycles(get_attribute(xml_operating_clock_setting, "num_cycles", loc_data).as_int(0));
  } else {
    archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_operating_clock_setting),
                   "Invalid <num_cycles> defined under <operating>");
  }
  sim_setting.set_operating_clock_frequency_slack(get_attribute(xml_operating_clock_setting, "slack", loc_data).as_float(0.));
  for (pugi::xml_node xml_clock : xml_operating_clock_setting.children()) {
    if (xml_clock.name() != std::string("clock")) {
      bad_tag(xml_clock, loc_data, xml_operating_clock_setting, {"clock"});
    }
    read_xml_operating_clock_override_setting(xml_clock, loc_data, sim_setting);
  } 
  pugi::xml_node xml_programming_clock_setting = get_single_child(xml_clock_setting, "programming", loc_data);
  sim_setting.set_programming_clock_frequency(get_attribute(xml_programming_clock_setting, "frequency", loc_data).as_float(0.));
}
static void read_xml_clock_setting ( pugi :: xml_node & xml_clock_setting , const pugiutil :: loc_data & loc_data , openfpga :: SimulationSetting & sim_setting ) { pugi :: xml_node xml_operating_clock_setting = get_single_child ( xml_clock_setting , " " , loc_data ) ; sim_setting . set_default_operating_clock_frequency ( get_attribute ( xml_operating_clock_setting , " " , loc_data ) . as_float ( 0. ) ) ; std :: string num_cycles_str = get_attribute ( xml_operating_clock_setting , " " , loc_data ) . as_string ( ) ; if ( std :: string ( " " ) == num_cycles_str ) { sim_setting . set_num_clock_cycles ( 0 ) ; } else if ( 0 < get_attribute ( xml_operating_clock_setting , " " , loc_data ) . as_int ( 0. ) ) { sim_setting . set_num_clock_cycles ( get_attribute ( xml_operating_clock_setting , " " , loc_data ) . as_int ( 0 ) ) ; } else { archfpga_throw ( loc_data . filename_c_str ( ) , loc_data . line ( xml_operating_clock_setting ) , " " ) ; } sim_setting . set_operating_clock_frequency_slack ( get_attribute ( xml_operating_clock_setting , " " , loc_data ) . as_float ( 0. ) ) ; for ( pugi :: xml_node xml_clock : xml_operating_clock_setting . children ( ) ) { if ( xml_clock . name ( ) != std :: string ( " " ) ) { bad_tag ( xml_clock , loc_data , xml_operating_clock_setting , { " " } ) ; } read_xml_operating_clock_override_setting ( xml_clock , loc_data , sim_setting ) ; } pugi :: xml_node xml_programming_clock_setting = get_single_child ( xml_clock_setting , " " , loc_data ) ; sim_setting . set_programming_clock_frequency ( get_attribute ( xml_programming_clock_setting , " " , loc_data ) . as_float ( 0. ) ) ; }
Parse XML codes of a <clock_setting> to an object of simulation setting
Parse XML codes of a <clock_setting > to an object of simulation setting
/* Parse operating clock setting */ /* Parse number of clock cycles to be used in simulation
   * Valid keywords is "auto" or other integer larger than 0
   */ /* Iterate over multiple operating clock settings and parse one by one */ /* Error out if the XML child has an invalid name! */ /* Parse programming clock setting */