scoreboard.c
void scoreboard_initializeFUs(stScoreboardCPU* a_pThis) {
	size_t i = 0;
	char fuIdx[2] = { 0 }; //Index is max 2 char 
	a_pThis->pLD_FUs = calloc(a_pThis->pConfiguration->ld_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pST_FUs = calloc(a_pThis->pConfiguration->st_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pADD_FUs = calloc(a_pThis->pConfiguration->add_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pSUB_FUs = calloc(a_pThis->pConfiguration->sub_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pMULT_FUs = calloc(a_pThis->pConfiguration->mul_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pDIV_FUs = calloc(a_pThis->pConfiguration->div_nr_units, sizeof(stFunctionalUnit));
	for (i=0; i<a_pThis->pConfiguration->ld_nr_units; ++i) {
			a_pThis->pLD_FUs[i].m_op = OPCODE_LD;
			strcpy(a_pThis->pLD_FUs[i].fuName, "LD");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pLD_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pLD_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */
				a_pThis->pTracedUnit = &a_pThis->pLD_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->st_nr_units; ++i) {
			a_pThis->pST_FUs[i].m_op = OPCODE_ST;
			strcpy(a_pThis->pST_FUs[i].fuName, "ST");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pST_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pST_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */
				a_pThis->pTracedUnit = &a_pThis->pST_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->add_nr_units; ++i) {
			a_pThis->pADD_FUs[i].m_op = OPCODE_ADD;
			strcpy(a_pThis->pADD_FUs[i].fuName, "ADD");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pADD_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pADD_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */
				a_pThis->pTracedUnit = &a_pThis->pADD_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->sub_nr_units; ++i) {
			a_pThis->pSUB_FUs[i].m_op = OPCODE_SUB;
			strcpy(a_pThis->pSUB_FUs[i].fuName, "SUB");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pSUB_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pSUB_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */
				a_pThis->pTracedUnit = &a_pThis->pSUB_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->mul_nr_units; ++i) {
			a_pThis->pMULT_FUs[i].m_op = OPCODE_MULT;
			strcpy(a_pThis->pMULT_FUs[i].fuName, "MUL");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pMULT_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pMULT_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */
				a_pThis->pTracedUnit = &a_pThis->pMULT_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->div_nr_units; ++i) {
			a_pThis->pDIV_FUs[i].m_op = OPCODE_DIV;
			strcpy(a_pThis->pDIV_FUs[i].fuName, "DIV");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pDIV_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pDIV_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */
				a_pThis->pTracedUnit = &a_pThis->pDIV_FUs[i];
			}
	}
}
/* This function Initializes the FUs and finds the traced */
This function Initializes the FUs and finds the traced
This function Initializes the FUs and finds the traced
void scoreboard_initializeFUs(stScoreboardCPU* a_pThis) {
	size_t i = 0;
	char fuIdx[2] = { 0 }; 
	a_pThis->pLD_FUs = calloc(a_pThis->pConfiguration->ld_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pST_FUs = calloc(a_pThis->pConfiguration->st_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pADD_FUs = calloc(a_pThis->pConfiguration->add_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pSUB_FUs = calloc(a_pThis->pConfiguration->sub_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pMULT_FUs = calloc(a_pThis->pConfiguration->mul_nr_units, sizeof(stFunctionalUnit));
	a_pThis->pDIV_FUs = calloc(a_pThis->pConfiguration->div_nr_units, sizeof(stFunctionalUnit));
	for (i=0; i<a_pThis->pConfiguration->ld_nr_units; ++i) {
			a_pThis->pLD_FUs[i].m_op = OPCODE_LD;
			strcpy(a_pThis->pLD_FUs[i].fuName, "LD");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pLD_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pLD_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { 
				a_pThis->pTracedUnit = &a_pThis->pLD_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->st_nr_units; ++i) {
			a_pThis->pST_FUs[i].m_op = OPCODE_ST;
			strcpy(a_pThis->pST_FUs[i].fuName, "ST");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pST_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pST_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { 
				a_pThis->pTracedUnit = &a_pThis->pST_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->add_nr_units; ++i) {
			a_pThis->pADD_FUs[i].m_op = OPCODE_ADD;
			strcpy(a_pThis->pADD_FUs[i].fuName, "ADD");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pADD_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pADD_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { 
				a_pThis->pTracedUnit = &a_pThis->pADD_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->sub_nr_units; ++i) {
			a_pThis->pSUB_FUs[i].m_op = OPCODE_SUB;
			strcpy(a_pThis->pSUB_FUs[i].fuName, "SUB");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pSUB_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pSUB_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { 
				a_pThis->pTracedUnit = &a_pThis->pSUB_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->mul_nr_units; ++i) {
			a_pThis->pMULT_FUs[i].m_op = OPCODE_MULT;
			strcpy(a_pThis->pMULT_FUs[i].fuName, "MUL");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pMULT_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pMULT_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { 
				a_pThis->pTracedUnit = &a_pThis->pMULT_FUs[i];
			}
	}
	for (i=0; i<a_pThis->pConfiguration->div_nr_units; ++i) {
			a_pThis->pDIV_FUs[i].m_op = OPCODE_DIV;
			strcpy(a_pThis->pDIV_FUs[i].fuName, "DIV");
			sprintf(fuIdx, "%ld", i);
			strcat(a_pThis->pDIV_FUs[i].fuName, fuIdx);
			if (strcmp(a_pThis->pDIV_FUs[i].fuName, a_pThis->pConfiguration->trace_unit) == 0) { 
				a_pThis->pTracedUnit = &a_pThis->pDIV_FUs[i];
			}
	}
}
void scoreboard_initializeFUs ( stScoreboardCPU * a_pThis ) { size_t i = 0 ; char fuIdx [ 2 ] = { 0 } ; a_pThis -> pLD_FUs = calloc ( a_pThis -> pConfiguration -> ld_nr_units , sizeof ( stFunctionalUnit ) ) ; a_pThis -> pST_FUs = calloc ( a_pThis -> pConfiguration -> st_nr_units , sizeof ( stFunctionalUnit ) ) ; a_pThis -> pADD_FUs = calloc ( a_pThis -> pConfiguration -> add_nr_units , sizeof ( stFunctionalUnit ) ) ; a_pThis -> pSUB_FUs = calloc ( a_pThis -> pConfiguration -> sub_nr_units , sizeof ( stFunctionalUnit ) ) ; a_pThis -> pMULT_FUs = calloc ( a_pThis -> pConfiguration -> mul_nr_units , sizeof ( stFunctionalUnit ) ) ; a_pThis -> pDIV_FUs = calloc ( a_pThis -> pConfiguration -> div_nr_units , sizeof ( stFunctionalUnit ) ) ; for ( i = 0 ; i < a_pThis -> pConfiguration -> ld_nr_units ; ++ i ) { a_pThis -> pLD_FUs [ i ] . m_op = OPCODE_LD ; strcpy ( a_pThis -> pLD_FUs [ i ] . fuName , " " ) ; sprintf ( fuIdx , " " , i ) ; strcat ( a_pThis -> pLD_FUs [ i ] . fuName , fuIdx ) ; if ( strcmp ( a_pThis -> pLD_FUs [ i ] . fuName , a_pThis -> pConfiguration -> trace_unit ) == 0 ) { a_pThis -> pTracedUnit = & a_pThis -> pLD_FUs [ i ] ; } } for ( i = 0 ; i < a_pThis -> pConfiguration -> st_nr_units ; ++ i ) { a_pThis -> pST_FUs [ i ] . m_op = OPCODE_ST ; strcpy ( a_pThis -> pST_FUs [ i ] . fuName , " " ) ; sprintf ( fuIdx , " " , i ) ; strcat ( a_pThis -> pST_FUs [ i ] . fuName , fuIdx ) ; if ( strcmp ( a_pThis -> pST_FUs [ i ] . fuName , a_pThis -> pConfiguration -> trace_unit ) == 0 ) { a_pThis -> pTracedUnit = & a_pThis -> pST_FUs [ i ] ; } } for ( i = 0 ; i < a_pThis -> pConfiguration -> add_nr_units ; ++ i ) { a_pThis -> pADD_FUs [ i ] . m_op = OPCODE_ADD ; strcpy ( a_pThis -> pADD_FUs [ i ] . fuName , " " ) ; sprintf ( fuIdx , " " , i ) ; strcat ( a_pThis -> pADD_FUs [ i ] . fuName , fuIdx ) ; if ( strcmp ( a_pThis -> pADD_FUs [ i ] . fuName , a_pThis -> pConfiguration -> trace_unit ) == 0 ) { a_pThis -> pTracedUnit = & a_pThis -> pADD_FUs [ i ] ; } } for ( i = 0 ; i < a_pThis -> pConfiguration -> sub_nr_units ; ++ i ) { a_pThis -> pSUB_FUs [ i ] . m_op = OPCODE_SUB ; strcpy ( a_pThis -> pSUB_FUs [ i ] . fuName , " " ) ; sprintf ( fuIdx , " " , i ) ; strcat ( a_pThis -> pSUB_FUs [ i ] . fuName , fuIdx ) ; if ( strcmp ( a_pThis -> pSUB_FUs [ i ] . fuName , a_pThis -> pConfiguration -> trace_unit ) == 0 ) { a_pThis -> pTracedUnit = & a_pThis -> pSUB_FUs [ i ] ; } } for ( i = 0 ; i < a_pThis -> pConfiguration -> mul_nr_units ; ++ i ) { a_pThis -> pMULT_FUs [ i ] . m_op = OPCODE_MULT ; strcpy ( a_pThis -> pMULT_FUs [ i ] . fuName , " " ) ; sprintf ( fuIdx , " " , i ) ; strcat ( a_pThis -> pMULT_FUs [ i ] . fuName , fuIdx ) ; if ( strcmp ( a_pThis -> pMULT_FUs [ i ] . fuName , a_pThis -> pConfiguration -> trace_unit ) == 0 ) { a_pThis -> pTracedUnit = & a_pThis -> pMULT_FUs [ i ] ; } } for ( i = 0 ; i < a_pThis -> pConfiguration -> div_nr_units ; ++ i ) { a_pThis -> pDIV_FUs [ i ] . m_op = OPCODE_DIV ; strcpy ( a_pThis -> pDIV_FUs [ i ] . fuName , " " ) ; sprintf ( fuIdx , " " , i ) ; strcat ( a_pThis -> pDIV_FUs [ i ] . fuName , fuIdx ) ; if ( strcmp ( a_pThis -> pDIV_FUs [ i ] . fuName , a_pThis -> pConfiguration -> trace_unit ) == 0 ) { a_pThis -> pTracedUnit = & a_pThis -> pDIV_FUs [ i ] ; } } }
This function Initializes the FUs and finds the traced
This function Initializes the FUs and finds the traced
//Index is max 2 char  /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */ /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */ /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */ /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */ /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */ /* strcmp() return an integer less than, equal to, or greater than zero if s1 is found */