src/node_stage.c
void node_fill_rs() {
  int64 rs_id;
  Op*   op          = NULL;
  uns32 num_fill_rs = 0;

  // Scan through issued nodes in node table that have not been issued to RS
  // yet.
  for(op = node->next_op_into_rs; op; op = op->next_node) {
    // Put your own issue functions here.
    if(FIND_EMPTIEST_RS) {
      rs_id = find_emptiest_rs(op);
    } else {
      // FIND_EMPTIEST_RS is currently the only issuer.
      rs_id = find_emptiest_rs(op);
    }

    if(rs_id == -1)
      break;

    Reservation_Station* rs = &node->rs[rs_id];
    ASSERT(node->proc_id, rs_id < NUM_RS);
    ASSERTM(node->proc_id, !rs->size || rs->rs_op_count < rs->size,
            "There must be at least one free space in selected RS!\n");

    ASSERT(node->proc_id, op->state == OS_ISSUED);
    op->state = OS_IN_RS;
    op->rs_id = (Counter)rs_id;
    rs->rs_op_count++;
    num_fill_rs++;
    DEBUG(node->proc_id, "Filling %s with op_num:%s (%d)\n", rs->name,
          unsstr64(op->op_num), rs->rs_op_count);
    if(op->srcs_not_rdy_vector == 0) {
      /* op is ready to issue right now */
      DEBUG(node->proc_id, "Adding to ready list  op_num:%s op:%s l1:%d\n",
            unsstr64(op->op_num), disasm_op(op, TRUE), op->engine_info.l1_miss);
      op->state = (cycle_count + 1 >= op->rdy_cycle ? OS_READY : OS_WAIT_FWD);
      op->next_rdy    = node->rdy_head;
      node->rdy_head  = op;
      op->in_rdy_list = TRUE;
    }

    // This is the max number of ops we can fill into the RS per cycle.
    // 0 means infinite.
    if(RS_FILL_WIDTH && (num_fill_rs == RS_FILL_WIDTH))
      break;
  }

  // had to stop issuing, this is the next node that should be issued to the RS
  node->next_op_into_rs = op;
}
/**************************************************************************************/
/* node_fill_rs: fill the scheduling window (RS) with oldest available ops.
 * Adding ops to their reservation stations. If they are ready, also add them to
 * the ready list.*/
fill the scheduling window (RS) with oldest available ops.
Adding ops to their reservation stations. If they are ready, also add them to
the ready list.
fill the scheduling window ( RS ) with oldest available ops . Adding ops to their reservation stations . If they are ready also add them to the ready list .
void node_fill_rs() {
  int64 rs_id;
  Op*   op          = NULL;
  uns32 num_fill_rs = 0;
  for(op = node->next_op_into_rs; op; op = op->next_node) {
    if(FIND_EMPTIEST_RS) {
      rs_id = find_emptiest_rs(op);
    } else {
      rs_id = find_emptiest_rs(op);
    }
    if(rs_id == -1)
      break;
    Reservation_Station* rs = &node->rs[rs_id];
    ASSERT(node->proc_id, rs_id < NUM_RS);
    ASSERTM(node->proc_id, !rs->size || rs->rs_op_count < rs->size,
            "There must be at least one free space in selected RS!\n");
    ASSERT(node->proc_id, op->state == OS_ISSUED);
    op->state = OS_IN_RS;
    op->rs_id = (Counter)rs_id;
    rs->rs_op_count++;
    num_fill_rs++;
    DEBUG(node->proc_id, "Filling %s with op_num:%s (%d)\n", rs->name,
          unsstr64(op->op_num), rs->rs_op_count);
    if(op->srcs_not_rdy_vector == 0) {
      DEBUG(node->proc_id, "Adding to ready list  op_num:%s op:%s l1:%d\n",
            unsstr64(op->op_num), disasm_op(op, TRUE), op->engine_info.l1_miss);
      op->state = (cycle_count + 1 >= op->rdy_cycle ? OS_READY : OS_WAIT_FWD);
      op->next_rdy    = node->rdy_head;
      node->rdy_head  = op;
      op->in_rdy_list = TRUE;
    }
    if(RS_FILL_WIDTH && (num_fill_rs == RS_FILL_WIDTH))
      break;
  }
  node->next_op_into_rs = op;
}
void node_fill_rs ( ) { int64 rs_id ; Op * op = NULL ; uns32 num_fill_rs = 0 ; for ( op = node -> next_op_into_rs ; op ; op = op -> next_node ) { if ( FIND_EMPTIEST_RS ) { rs_id = find_emptiest_rs ( op ) ; } else { rs_id = find_emptiest_rs ( op ) ; } if ( rs_id == -1 ) break ; Reservation_Station * rs = & node -> rs [ rs_id ] ; ASSERT ( node -> proc_id , rs_id < NUM_RS ) ; ASSERTM ( node -> proc_id , ! rs -> size || rs -> rs_op_count < rs -> size , " \n " ) ; ASSERT ( node -> proc_id , op -> state == OS_ISSUED ) ; op -> state = OS_IN_RS ; op -> rs_id = ( Counter ) rs_id ; rs -> rs_op_count ++ ; num_fill_rs ++ ; DEBUG ( node -> proc_id , " \n " , rs -> name , unsstr64 ( op -> op_num ) , rs -> rs_op_count ) ; if ( op -> srcs_not_rdy_vector == 0 ) { DEBUG ( node -> proc_id , " \n " , unsstr64 ( op -> op_num ) , disasm_op ( op , TRUE ) , op -> engine_info . l1_miss ) ; op -> state = ( cycle_count + 1 >= op -> rdy_cycle ? OS_READY : OS_WAIT_FWD ) ; op -> next_rdy = node -> rdy_head ; node -> rdy_head = op ; op -> in_rdy_list = TRUE ; } if ( RS_FILL_WIDTH && ( num_fill_rs == RS_FILL_WIDTH ) ) break ; } node -> next_op_into_rs = op ; }
node_fill_rs: fill the scheduling window (RS) with oldest available ops.
node_fill_rs : fill the scheduling window ( RS ) with oldest available ops .
// Scan through issued nodes in node table that have not been issued to RS // yet. // Put your own issue functions here. // FIND_EMPTIEST_RS is currently the only issuer. /* op is ready to issue right now */ // This is the max number of ops we can fill into the RS per cycle. // 0 means infinite. // had to stop issuing, this is the next node that should be issued to the RS