scoreboard.c
void scoreboard_readOperands(stScoreboardCPU* a_pThis) {
	int relatedPC = 0;
	size_t i = 0;
	for (i=0; i<NUM_OF_REGISTERS; ++i) {
		if (a_pThis->registerResultStatus[i] != NULL) { /* Check for active FUs */
			stFunctionalUnit *currFU = a_pThis->registerResultStatus[i];
			relatedPC = currFU->relatedPC;
			if (a_pThis->instructionStatus[ISSUE_STAGE_IDX][relatedPC] != a_pThis->cycle) { /* Check that we are not reading the operands in the same cycle as the issue cycle */
				if (currFU->Busy && currFU->Rj && currFU->Rk) { /* Check the ReadOperands conditions */
					currFU->Rj = false;
					currFU->Rk = false;
					currFU->time_left--;
					scoreboard_performOper(a_pThis, currFU);
					a_pThis->instructionStatus[READ_REGISTERS_STAGE_IDX][relatedPC] = a_pThis->cycle;
				}
			}
		}
	}
}
/* This function performs the Read operands stage of the scorecoard. It checks if there is no
 * data hazards (RAW) before starting the execution (first cycle of execution is done here) */
This function performs the Read operands stage of the scorecoard. It checks if there is no
data hazards (RAW) before starting the execution (first cycle of execution is done here)
This function performs the Read operands stage of the scorecoard . It checks if there is no data hazards ( RAW ) before starting the execution ( first cycle of execution is done here )
void scoreboard_readOperands(stScoreboardCPU* a_pThis) {
	int relatedPC = 0;
	size_t i = 0;
	for (i=0; i<NUM_OF_REGISTERS; ++i) {
		if (a_pThis->registerResultStatus[i] != NULL) { 
			stFunctionalUnit *currFU = a_pThis->registerResultStatus[i];
			relatedPC = currFU->relatedPC;
			if (a_pThis->instructionStatus[ISSUE_STAGE_IDX][relatedPC] != a_pThis->cycle) { 
				if (currFU->Busy && currFU->Rj && currFU->Rk) { 
					currFU->Rj = false;
					currFU->Rk = false;
					currFU->time_left--;
					scoreboard_performOper(a_pThis, currFU);
					a_pThis->instructionStatus[READ_REGISTERS_STAGE_IDX][relatedPC] = a_pThis->cycle;
				}
			}
		}
	}
}
void scoreboard_readOperands ( stScoreboardCPU * a_pThis ) { int relatedPC = 0 ; size_t i = 0 ; for ( i = 0 ; i < NUM_OF_REGISTERS ; ++ i ) { if ( a_pThis -> registerResultStatus [ i ] != NULL ) { stFunctionalUnit * currFU = a_pThis -> registerResultStatus [ i ] ; relatedPC = currFU -> relatedPC ; if ( a_pThis -> instructionStatus [ ISSUE_STAGE_IDX ] [ relatedPC ] != a_pThis -> cycle ) { if ( currFU -> Busy && currFU -> Rj && currFU -> Rk ) { currFU -> Rj = false ; currFU -> Rk = false ; currFU -> time_left -- ; scoreboard_performOper ( a_pThis , currFU ) ; a_pThis -> instructionStatus [ READ_REGISTERS_STAGE_IDX ] [ relatedPC ] = a_pThis -> cycle ; } } } } }
This function performs the Read operands stage of the scorecoard.
This function performs the Read operands stage of the scorecoard .
/* Check for active FUs */ /* Check that we are not reading the operands in the same cycle as the issue cycle */ /* Check the ReadOperands conditions */