src/node_stage.c
int64 find_emptiest_rs(Op* op) {
  int64 emptiest_rs_id    = -1;
  int64 emptiest_rs_slots = -1;

  /*Iterate through RSs looking for an available RS that is connected
    to an FU that can execute the OP.*/
  for(int64 rs_id = 0; rs_id < NUM_RS; ++rs_id) {
    Reservation_Station* rs = &node->rs[rs_id];
    ASSERT(node->proc_id, !rs->size || rs->rs_op_count <= rs->size);
    ASSERTM(node->proc_id, rs->size,
            "Infinite RS not suppoted by find_emptiest_rs issuer.");
    for(uns32 i = 0; i < rs->num_fus; ++i) {
      Func_Unit* fu = rs->connected_fus[i];

      // This FU can execute this op
      if(get_fu_type(op->table_info->op_type, op->table_info->is_simd) &
         fu->type) {
        // Find the emptiest RS
        int32 num_empty_slots = rs->size - rs->rs_op_count;
        if(num_empty_slots != 0) {
          if(emptiest_rs_slots < num_empty_slots) {
            // Found a new emptiest rs
            emptiest_rs_id    = rs_id;
            emptiest_rs_slots = num_empty_slots;
          }
        }
      }
    }
  }

  return emptiest_rs_id;
}
/**************************************************************************************/
/* Issuers:
 *      The interface to the issue functions is that Scarab will pass the
 * function the op to be issued, and the issuer will return the RS id that the
 * op should be issued to, or -1 meaning that there is no RS for the op to
 * be issued to. See FIND_EMPTIEST_RS for an example.
 *
 *      +FIND_EMPTIEST_RS: will always select the RS with the most empty slots
 */
The interface to the issue functions is that Scarab will pass the
function the op to be issued, and the issuer will return the RS id that the
op should be issued to, or -1 meaning that there is no RS for the op to
be issued to. See FIND_EMPTIEST_RS for an example.

+FIND_EMPTIEST_RS: will always select the RS with the most empty slots
The interface to the issue functions is that Scarab will pass the function the op to be issued and the issuer will return the RS id that the op should be issued to or - 1 meaning that there is no RS for the op to be issued to . See FIND_EMPTIEST_RS for an example . + FIND_EMPTIEST_RS : will always select the RS with the most empty slots
int64 find_emptiest_rs(Op* op) {
  int64 emptiest_rs_id    = -1;
  int64 emptiest_rs_slots = -1;
  for(int64 rs_id = 0; rs_id < NUM_RS; ++rs_id) {
    Reservation_Station* rs = &node->rs[rs_id];
    ASSERT(node->proc_id, !rs->size || rs->rs_op_count <= rs->size);
    ASSERTM(node->proc_id, rs->size,
            "Infinite RS not suppoted by find_emptiest_rs issuer.");
    for(uns32 i = 0; i < rs->num_fus; ++i) {
      Func_Unit* fu = rs->connected_fus[i];
      if(get_fu_type(op->table_info->op_type, op->table_info->is_simd) &
         fu->type) {
        int32 num_empty_slots = rs->size - rs->rs_op_count;
        if(num_empty_slots != 0) {
          if(emptiest_rs_slots < num_empty_slots) {
            emptiest_rs_id    = rs_id;
            emptiest_rs_slots = num_empty_slots;
          }
        }
      }
    }
  }
  return emptiest_rs_id;
}
int64 find_emptiest_rs ( Op * op ) { int64 emptiest_rs_id = -1 ; int64 emptiest_rs_slots = -1 ; for ( int64 rs_id = 0 ; rs_id < NUM_RS ; ++ rs_id ) { Reservation_Station * rs = & node -> rs [ rs_id ] ; ASSERT ( node -> proc_id , ! rs -> size || rs -> rs_op_count <= rs -> size ) ; ASSERTM ( node -> proc_id , rs -> size , " " ) ; for ( uns32 i = 0 ; i < rs -> num_fus ; ++ i ) { Func_Unit * fu = rs -> connected_fus [ i ] ; if ( get_fu_type ( op -> table_info -> op_type , op -> table_info -> is_simd ) & fu -> type ) { int32 num_empty_slots = rs -> size - rs -> rs_op_count ; if ( num_empty_slots != 0 ) { if ( emptiest_rs_slots < num_empty_slots ) { emptiest_rs_id = rs_id ; emptiest_rs_slots = num_empty_slots ; } } } } } return emptiest_rs_id ; }
Issuers:
      The interface to the issue functions is that Scarab will pass the
 function the op to be issued, and the issuer will return the RS id that the
 op should be issued to, or -1 meaning that there is no RS for the op to
 be issued to.
Issuers : The interface to the issue functions is that Scarab will pass the function the op to be issued and the issuer will return the RS id that the op should be issued to or - 1 meaning that there is no RS for the op to be issued to .
/*Iterate through RSs looking for an available RS that is connected
    to an FU that can execute the OP.*/ // This FU can execute this op // Find the emptiest RS // Found a new emptiest rs