Beispiel #1
0
int main()
{
    if(!load_image()){
        puts("Cannot load the images");
        return 0;
    }
    init();

    cycle = 0;
    error_halt = false;

    int i = PC/4;

    while( i < MEM_SIZE/4){
		haltCnt = 0;
		print_cycle();
		/*if( (imem[i]>>26)==HALT){
            haltCnt++;
            printf("cycle: %d %s %08X\n",cycle, instr_toString(imem[i]), imem[i]);
		}*/

		load_hazard = false;

		cycle++;


		WB_stage();

		DM_stage();

		EX_stage();

		ID_stage();

		IF_stage(&i);


		updateReg();

		print_pipeline_stage();

        if(error_halt || haltCnt==5){
            break;
        }
    }
    //printf("%08X  %08X  %08X\n", imem[0x28/4], imem[0x34/4], imem[0x38/4]);
   // printf("haltCnt:%d  error_halt:%d\n",haltCnt, error_halt);
   // printf("%d\n",cycle);
    fclose(snapshot);
    fclose(error_dump);
    return 0;
}
Beispiel #2
0
void DoWhileStatement::print(int deep) const {
	cout << string(deep * 2, ' ') << "do .. while()" << endl;
	print_cycle(deep, condition, body);
}