scoreboard.c
bool scoreboard_fetch(stScoreboardCPU* a_pThis) {
	command_row_t cmd;
	/* Load & parse PC instruction from memin into the Q */
	if (parse_opcode(a_pThis->pMemory[a_pThis->PC], &cmd) == FAILURE) {
		return FAILURE;
	}
	if (InstQ_Enqueue(a_pThis->InstructionQ, cmd) == SUCCESS) { /* If enqueue was successful - increase PC */
		if (cmd.opcode == OPCODE_HALT) {
			a_pThis->halted = true;
		} else if (a_pThis->PC < (MEMORY_SIZE - 1)) {
			a_pThis->PC++;
		} else {
			return FAILURE;
		}
	} else {
		return FAILURE;
	}
	return SUCCESS;
}
/* This function fetches the next instruction from memory into the instruction Queue
 * The function return SUCCESS (true) on sucess and FAILURE (false) otherwise */
This function fetches the next instruction from memory into the instruction Queue
The function return SUCCESS (true) on sucess and FAILURE (false) otherwise
This function fetches the next instruction from memory into the instruction Queue The function return SUCCESS ( true ) on sucess and FAILURE ( false ) otherwise
bool scoreboard_fetch(stScoreboardCPU* a_pThis) {
	command_row_t cmd;
	if (parse_opcode(a_pThis->pMemory[a_pThis->PC], &cmd) == FAILURE) {
		return FAILURE;
	}
	if (InstQ_Enqueue(a_pThis->InstructionQ, cmd) == SUCCESS) { 
		if (cmd.opcode == OPCODE_HALT) {
			a_pThis->halted = true;
		} else if (a_pThis->PC < (MEMORY_SIZE - 1)) {
			a_pThis->PC++;
		} else {
			return FAILURE;
		}
	} else {
		return FAILURE;
	}
	return SUCCESS;
}
bool scoreboard_fetch ( stScoreboardCPU * a_pThis ) { command_row_t cmd ; if ( parse_opcode ( a_pThis -> pMemory [ a_pThis -> PC ] , & cmd ) == FAILURE ) { return FAILURE ; } if ( InstQ_Enqueue ( a_pThis -> InstructionQ , cmd ) == SUCCESS ) { if ( cmd . opcode == OPCODE_HALT ) { a_pThis -> halted = true ; } else if ( a_pThis -> PC < ( MEMORY_SIZE - 1 ) ) { a_pThis -> PC ++ ; } else { return FAILURE ; } } else { return FAILURE ; } return SUCCESS ; }
This function fetches the next instruction from memory into the instruction Queue
 The function return SUCCESS (true) on sucess and FAILURE (false) otherwise
This function fetches the next instruction from memory into the instruction Queue The function return SUCCESS ( true ) on sucess and FAILURE ( false ) otherwise
/* Load & parse PC instruction from memin into the Q */ /* If enqueue was successful - increase PC */