src/node_stage.c
void oldest_first_sched(Op* op) {
  int32 youngest_slot_op_id = -1;  //-1 means not found

  // Iterate through the FUs that this RS is connected to.
  Reservation_Station* rs = &node->rs[op->rs_id];
  for(uns32 i = 0; i < rs->num_fus; ++i) {
    Func_Unit* fu    = rs->connected_fus[i];
    uns32      fu_id = fu->fu_id;

    // check if this op can be executed by this FU
    if(get_fu_type(op->table_info->op_type, op->table_info->is_simd) &
       fu->type) {
      Op* s_op = node->sd.ops[fu_id];
      if(!s_op) {  // nobody has been scheduled to this FU yet
        DEBUG(node->proc_id,
              "Scheduler selecting    op_num:%s  fu_id:%d op:%s l1:%d\n",
              unsstr64(op->op_num), fu_id, disasm_op(op, TRUE),
              op->engine_info.l1_miss);
        ASSERT(node->proc_id, fu_id < node->sd.max_op_count);
        op->fu_num                 = fu_id;
        node->sd.ops[op->fu_num]   = op;
        node->last_scheduled_opnum = op->op_num;
        node->sd.op_count += !s_op;
        ASSERT(node->proc_id, node->sd.op_count <= node->sd.max_op_count);
        youngest_slot_op_id = -1;
        break;
      } else if(op->op_num < s_op->op_num) {
        // The slot is not empty, but we are older than the op that is in the
        // slot
        if(youngest_slot_op_id == -1) {
          youngest_slot_op_id = fu_id;
        } else {
          Op* youngest_op = node->sd.ops[youngest_slot_op_id];
          if(s_op->op_num > youngest_op->op_num) {
            // this slot is younger than the youngest known op
            youngest_slot_op_id = fu_id;
          }
        }
      }
    }
  }

  if(youngest_slot_op_id != -1) {
    /*Did not find an empty slot, but we did find a slot that is younger that
     * us*/
    uns32 fu_id = youngest_slot_op_id;
    DEBUG(node->proc_id,
          "Scheduler selecting    op_num:%s  fu_id:%d op:%s l1:%d\n",
          unsstr64(op->op_num), fu_id, disasm_op(op, TRUE),
          op->engine_info.l1_miss);
    ASSERT(node->proc_id, fu_id < node->sd.max_op_count);
    op->fu_num                 = fu_id;
    node->sd.ops[op->fu_num]   = op;
    node->last_scheduled_opnum = op->op_num;
    node->sd.op_count += 0;  // replacing an op, not adding a new one.
    ASSERT(node->proc_id, node->sd.op_count <= node->sd.max_op_count);
  } else {
    /*Did not find an empty slot or a slot that is younger than me, do nothing*/
  }
}
/**************************************************************************************/
/* Schedulers:
 *      The interface to the schedule functions is that Scarab will pass the
 * function the ready op, and the scheduler will return the selected ops in
 * node->sd. See OLDEST_FIRST_SCHED for an example. Note, it is not
 * necessary to look at FU availability in this stage, if the FU is busy,
 * then the op will be ignored and available to schedule again in the next
 * stage.
 *
 *      +OLDEST_FIRST_SCHED: will always select the oldest ready ops to schedule
 */
The interface to the schedule functions is that Scarab will pass the
function the ready op, and the scheduler will return the selected ops in
node->sd. See OLDEST_FIRST_SCHED for an example. Note, it is not
necessary to look at FU availability in this stage, if the FU is busy,
then the op will be ignored and available to schedule again in the next
stage.

+OLDEST_FIRST_SCHED: will always select the oldest ready ops to schedule
The interface to the schedule functions is that Scarab will pass the function the ready op and the scheduler will return the selected ops in node - > sd . See OLDEST_FIRST_SCHED for an example . Note it is not necessary to look at FU availability in this stage if the FU is busy then the op will be ignored and available to schedule again in the next stage . + OLDEST_FIRST_SCHED : will always select the oldest ready ops to schedule
void oldest_first_sched(Op* op) {
  int32 youngest_slot_op_id = -1;  
  Reservation_Station* rs = &node->rs[op->rs_id];
  for(uns32 i = 0; i < rs->num_fus; ++i) {
    Func_Unit* fu    = rs->connected_fus[i];
    uns32      fu_id = fu->fu_id;
    if(get_fu_type(op->table_info->op_type, op->table_info->is_simd) &
       fu->type) {
      Op* s_op = node->sd.ops[fu_id];
      if(!s_op) {  
        DEBUG(node->proc_id,
              "Scheduler selecting    op_num:%s  fu_id:%d op:%s l1:%d\n",
              unsstr64(op->op_num), fu_id, disasm_op(op, TRUE),
              op->engine_info.l1_miss);
        ASSERT(node->proc_id, fu_id < node->sd.max_op_count);
        op->fu_num                 = fu_id;
        node->sd.ops[op->fu_num]   = op;
        node->last_scheduled_opnum = op->op_num;
        node->sd.op_count += !s_op;
        ASSERT(node->proc_id, node->sd.op_count <= node->sd.max_op_count);
        youngest_slot_op_id = -1;
        break;
      } else if(op->op_num < s_op->op_num) {
        if(youngest_slot_op_id == -1) {
          youngest_slot_op_id = fu_id;
        } else {
          Op* youngest_op = node->sd.ops[youngest_slot_op_id];
          if(s_op->op_num > youngest_op->op_num) {
            youngest_slot_op_id = fu_id;
          }
        }
      }
    }
  }
  if(youngest_slot_op_id != -1) {
    uns32 fu_id = youngest_slot_op_id;
    DEBUG(node->proc_id,
          "Scheduler selecting    op_num:%s  fu_id:%d op:%s l1:%d\n",
          unsstr64(op->op_num), fu_id, disasm_op(op, TRUE),
          op->engine_info.l1_miss);
    ASSERT(node->proc_id, fu_id < node->sd.max_op_count);
    op->fu_num                 = fu_id;
    node->sd.ops[op->fu_num]   = op;
    node->last_scheduled_opnum = op->op_num;
    node->sd.op_count += 0;  
    ASSERT(node->proc_id, node->sd.op_count <= node->sd.max_op_count);
  } else {
  }
}
void oldest_first_sched ( Op * op ) { int32 youngest_slot_op_id = -1 ; Reservation_Station * rs = & node -> rs [ op -> rs_id ] ; for ( uns32 i = 0 ; i < rs -> num_fus ; ++ i ) { Func_Unit * fu = rs -> connected_fus [ i ] ; uns32 fu_id = fu -> fu_id ; if ( get_fu_type ( op -> table_info -> op_type , op -> table_info -> is_simd ) & fu -> type ) { Op * s_op = node -> sd . ops [ fu_id ] ; if ( ! s_op ) { DEBUG ( node -> proc_id , " \n " , unsstr64 ( op -> op_num ) , fu_id , disasm_op ( op , TRUE ) , op -> engine_info . l1_miss ) ; ASSERT ( node -> proc_id , fu_id < node -> sd . max_op_count ) ; op -> fu_num = fu_id ; node -> sd . ops [ op -> fu_num ] = op ; node -> last_scheduled_opnum = op -> op_num ; node -> sd . op_count += ! s_op ; ASSERT ( node -> proc_id , node -> sd . op_count <= node -> sd . max_op_count ) ; youngest_slot_op_id = -1 ; break ; } else if ( op -> op_num < s_op -> op_num ) { if ( youngest_slot_op_id == -1 ) { youngest_slot_op_id = fu_id ; } else { Op * youngest_op = node -> sd . ops [ youngest_slot_op_id ] ; if ( s_op -> op_num > youngest_op -> op_num ) { youngest_slot_op_id = fu_id ; } } } } } if ( youngest_slot_op_id != -1 ) { uns32 fu_id = youngest_slot_op_id ; DEBUG ( node -> proc_id , " \n " , unsstr64 ( op -> op_num ) , fu_id , disasm_op ( op , TRUE ) , op -> engine_info . l1_miss ) ; ASSERT ( node -> proc_id , fu_id < node -> sd . max_op_count ) ; op -> fu_num = fu_id ; node -> sd . ops [ op -> fu_num ] = op ; node -> last_scheduled_opnum = op -> op_num ; node -> sd . op_count += 0 ; ASSERT ( node -> proc_id , node -> sd . op_count <= node -> sd . max_op_count ) ; } else { } }
Schedulers:
      The interface to the schedule functions is that Scarab will pass the
 function the ready op, and the scheduler will return the selected ops in
 node->sd.
Schedulers : The interface to the schedule functions is that Scarab will pass the function the ready op and the scheduler will return the selected ops in node - > sd .
//-1 means not found // Iterate through the FUs that this RS is connected to. // check if this op can be executed by this FU // nobody has been scheduled to this FU yet // The slot is not empty, but we are older than the op that is in the // slot // this slot is younger than the youngest known op /*Did not find an empty slot, but we did find a slot that is younger that
     * us*/ // replacing an op, not adding a new one. /*Did not find an empty slot or a slot that is younger than me, do nothing*/