libopenfpga/libarchopenfpga/src/check_circuit_library.cpp
/************************************************************************
 * A generic function to check the port size of a given circuit model
 * if the number of ports in the given type does not match, we give an error 
 * for each port, if the port size does not match, we give an error 
 ***********************************************************************/
A generic function to check the port size of a given circuit model
if the number of ports in the given type does not match, we give an error
for each port, if the port size does not match, we give an error
A generic function to check the port size of a given circuit model if the number of ports in the given type does not match we give an error for each port if the port size does not match we give an error
size_t check_one_circuit_model_port_type_and_size_required(const CircuitLibrary& circuit_lib,
                                                           const CircuitModelId& circuit_model, 
                                                           const enum e_circuit_model_port_type& port_type_to_check,
                                                           const size_t& num_ports_to_check,
                                                           const size_t& port_size_to_check,
                                                           const bool& include_global_ports) {
  size_t num_err = 0;
  std::vector<CircuitPortId> ports = circuit_lib.model_ports_by_type(circuit_model, port_type_to_check, false == include_global_ports);
  if (num_ports_to_check != ports.size()) {
    VTR_LOG_ERROR("Expect %d %s ports for a %s circuit model, but only have %d %s ports!\n",
                  num_ports_to_check,
                  CIRCUIT_MODEL_PORT_TYPE_STRING[size_t(port_type_to_check)],
                  CIRCUIT_MODEL_TYPE_STRING[size_t(circuit_lib.model_type(circuit_model))], 
               ports.size(),
               CIRCUIT_MODEL_PORT_TYPE_STRING[size_t(port_type_to_check)]);
    num_err++;
  } 
  for (const auto& port : ports) { 
    num_err += check_one_circuit_model_port_size_required(circuit_lib,
                                                          circuit_model, 
                                                          port, port_size_to_check);
  }
  return num_err;
}
size_t check_one_circuit_model_port_type_and_size_required ( const CircuitLibrary & circuit_lib , const CircuitModelId & circuit_model , const enum e_circuit_model_port_type & port_type_to_check , const size_t & num_ports_to_check , const size_t & port_size_to_check , const bool & include_global_ports ) { size_t num_err = 0 ; std :: vector < CircuitPortId > ports = circuit_lib . model_ports_by_type ( circuit_model , port_type_to_check , false == include_global_ports ) ; if ( num_ports_to_check != ports . size ( ) ) { VTR_LOG_ERROR ( " \n " , num_ports_to_check , CIRCUIT_MODEL_PORT_TYPE_STRING [ size_t ( port_type_to_check ) ] , CIRCUIT_MODEL_TYPE_STRING [ size_t ( circuit_lib . model_type ( circuit_model ) ) ] , ports . size ( ) , CIRCUIT_MODEL_PORT_TYPE_STRING [ size_t ( port_type_to_check ) ] ) ; num_err ++ ; } for ( const auto & port : ports ) { num_err += check_one_circuit_model_port_size_required ( circuit_lib , circuit_model , port , port_size_to_check ) ; } return num_err ; }
A generic function to check the port size of a given circuit model
 if the number of ports in the given type does not match, we give an error
 for each port, if the port size does not match, we give an error
A generic function to check the port size of a given circuit model if the number of ports in the given type does not match we give an error for each port if the port size does not match we give an error