libopenfpga/libarchopenfpga/src/read_xml_circuit_library.cpp
/********************************************************************
 * Identify the output mask of the port in LUTs, 
 * by default it will be applied to each pin of this port
 * This is only applicable to output ports of a LUT
 *******************************************************************/
Identify the output mask of the port in LUTs,
by default it will be applied to each pin of this port
This is only applicable to output ports of a LUT
Identify the output mask of the port in LUTs by default it will be applied to each pin of this port This is only applicable to output ports of a LUT
static 
void read_xml_output_mask(pugi::xml_node& xml_port,
                          const pugiutil::loc_data& loc_data,
                          CircuitLibrary& circuit_lib, const CircuitPortId& port) {
  std::string output_mask_attr = get_attribute(xml_port, "lut_output_mask", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string();
  std::vector<size_t> mask_vector;
  if (!output_mask_attr.empty()) {
    openfpga::StringToken string_tokenizer(get_attribute(xml_port, "lut_output_mask", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string(nullptr));
    for (const std::string& mask_token : string_tokenizer.split(',')) {
      mask_vector.push_back(std::atoi(mask_token.c_str()));
    }
    if (circuit_lib.port_size(port) != mask_vector.size()) {
      archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_port),
                     "Invalid lut_output_mask attribute '%s'! It must match the port size (=%lu)\n",
                     output_mask_attr.c_str(), circuit_lib.port_size(port));
    } 
  } else {
    mask_vector.resize(circuit_lib.port_size(port));
    std::iota(mask_vector.begin(), mask_vector.end(), 0);
  }
  circuit_lib.set_port_lut_output_mask(port, mask_vector);
}
static void read_xml_output_mask ( pugi :: xml_node & xml_port , const pugiutil :: loc_data & loc_data , CircuitLibrary & circuit_lib , const CircuitPortId & port ) { std :: string output_mask_attr = get_attribute ( xml_port , " " , loc_data , pugiutil :: ReqOpt :: OPTIONAL ) . as_string ( ) ; std :: vector < size_t > mask_vector ; if ( ! output_mask_attr . empty ( ) ) { openfpga :: StringToken string_tokenizer ( get_attribute ( xml_port , " " , loc_data , pugiutil :: ReqOpt :: OPTIONAL ) . as_string ( nullptr ) ) ; for ( const std :: string & mask_token : string_tokenizer . split ( ' ' ) ) { mask_vector . push_back ( std :: atoi ( mask_token . c_str ( ) ) ) ; } if ( circuit_lib . port_size ( port ) != mask_vector . size ( ) ) { archfpga_throw ( loc_data . filename_c_str ( ) , loc_data . line ( xml_port ) , " \n " , output_mask_attr . c_str ( ) , circuit_lib . port_size ( port ) ) ; } } else { mask_vector . resize ( circuit_lib . port_size ( port ) ) ; std :: iota ( mask_vector . begin ( ) , mask_vector . end ( ) , 0 ) ; } circuit_lib . set_port_lut_output_mask ( port , mask_vector ) ; }
Identify the output mask of the port in LUTs,
 by default it will be applied to each pin of this port
 This is only applicable to output ports of a LUT
Identify the output mask of the port in LUTs by default it will be applied to each pin of this port This is only applicable to output ports of a LUT
/* Split the string with token ',' */ /* Make sure that the size of mask fits the port size */ /* By default, we give a mask vector covering each pin of the port */