openfpga/src/annotation/check_pb_type_annotation.cpp
/********************************************************************
 * This function will check the mode_bits annotation for each pb_type 
 *  - If a primitive pb_type has mode bits, it must have been linked to a physical pb_type
 *  - If a primitive pb_type has mode bits, the circuit model must have 
 *    a port for mode selection. And the port size must match the length of mode bits
 *
 * Note:
 *  - This function should be run after circuit mode and mode bits annotation 
 *    is completed 
 *******************************************************************/
This function will check the mode_bits annotation for each pb_type
- If a primitive pb_type has mode bits, it must have been linked to a physical pb_type
- If a primitive pb_type has mode bits, the circuit model must have
a port for mode selection. And the port size must match the length of mode bits

- This function should be run after circuit mode and mode bits annotation
is completed
This function will check the mode_bits annotation for each pb_type - If a primitive pb_type has mode bits it must have been linked to a physical pb_type - If a primitive pb_type has mode bits the circuit model must have a port for mode selection . And the port size must match the length of mode bits - This function should be run after circuit mode and mode bits annotation is completed
void check_vpr_pb_type_mode_bits_annotation(const DeviceContext& vpr_device_ctx, 
                                            const CircuitLibrary& circuit_lib,
                                            const VprDeviceAnnotation& vpr_device_annotation) {
  size_t num_err = 0;
  for (const t_logical_block_type& lb_type : vpr_device_ctx.logical_block_types) {
    if (nullptr == lb_type.pb_type) {
      continue;
    }
    rec_check_vpr_pb_type_mode_bits_annotation(lb_type.pb_type, circuit_lib, vpr_device_annotation, num_err);
  }
  if (0 == num_err) {
    VTR_LOG("Check pb_type annotation for mode selection bits passed.\n");
  } else {
    VTR_LOG_ERROR("Check physical pb_type annotation for mode selection bits failed with %ld errors!\n",
                  num_err);
  }
}
void check_vpr_pb_type_mode_bits_annotation ( const DeviceContext & vpr_device_ctx , const CircuitLibrary & circuit_lib , const VprDeviceAnnotation & vpr_device_annotation ) { size_t num_err = 0 ; for ( const t_logical_block_type & lb_type : vpr_device_ctx . logical_block_types ) { if ( nullptr == lb_type . pb_type ) { continue ; } rec_check_vpr_pb_type_mode_bits_annotation ( lb_type . pb_type , circuit_lib , vpr_device_annotation , num_err ) ; } if ( 0 == num_err ) { VTR_LOG ( " \n " ) ; } else { VTR_LOG_ERROR ( " \n " , num_err ) ; } }
This function will check the mode_bits annotation for each pb_type
  - If a primitive pb_type has mode bits, it must have been linked to a physical pb_type
  - If a primitive pb_type has mode bits, the circuit model must have
    a port for mode selection.
This function will check the mode_bits annotation for each pb_type - If a primitive pb_type has mode bits it must have been linked to a physical pb_type - If a primitive pb_type has mode bits the circuit model must have a port for mode selection .
/* By pass nullptr for pb_type head */ /* Top pb_type should always has a physical mode! */