bool EXECUTE(int ret_inst) { cout << "\n\t At any time during the exection of the program, the following keywords can be used\n"; cout << "\t'rc' : To change the current register contents\n"; cout << "\t'rd' : To display the current register contents\n"; cout << "\t'md' : To display the current memory and register contents\n"; cout << "\t'mc' : To change the current execution mode\n"; cout << "\t'rc' : To change the current break point state \n"; cout << "\t'fp' : To print all the current flag contents\n"; string tmp = "" , mode = ""; char input[100];input[0]=0; cout << "\n Set the Execution Mode by pressing one of the following :\n"; cout << "\t'm' : execute Microinstruction by Microinstruction\n"; cout << "\t'i' : execute Instruction by Instruction\n"; cout << "\t'p' : execute entire program (default mode)\n"; strcpy(input,"p"); while (true) { cout << "\tExecution Mode : "; getchar(); scanf("%[^\n]",input); mode = input ; if (mode != "p" && mode !="m" && mode!="i") { cout << "Invalid Entry . Press (m/i/p) .\n"; continue ; } break; } cout << "\tPress 'bp' to set additional break-points besides (brk) in the program : "; getchar(); scanf("%[^\n]",input); tmp = input ; bool be = false ; if (tmp == "bp") { if (SetBreakPoints() == false ) return false ; } cout << "\tPress be/bd to enable/disable all break-points (default disable)\n"; string Microinstruction=""; int count_inst = -1; // Counter to count the number of instructions executed cout << "\n\tProgram Execution Begins .......\n\n"; while ( TRUE ) { /* This is the main loop. All modules are executed in this order. NOTICE */ ret_inst = MS.Sequencer(ret_inst , DC , FL); if (ret_inst == 0) count_inst++; Microinstruction = MPM.Fetch(ret_inst); PC.Operation(Microinstruction , DB); //Program Counter Module MR.Operation(Microinstruction,DB); //Memory Address Module Mem.Operation(Microinstruction,DB,MR); //Memory Address Module DC.Operation(Microinstruction,DB); //Decoder Module MS.Operation(Microinstruction,DC); //MicroSequencer Module IOR.Operation(Microinstruction,DB,RG,FL); //Instr. Oper. Register Module RG.Operation(Microinstruction,DB,PC,SP,AC,OP,ALU1); //Register File Module OP.Operation(Microinstruction,DB); //Operand Module AC.S_Operation(Microinstruction,DB); // Special Accumulator Operation (only to EAR) ALU1.Operation(Microinstruction,DB,OP,FL); //ALU Module AC.Operation(Microinstruction,DB,ALU1); //Accumulator Module SP.Operation(Microinstruction,DB); //Stack Module MR.Operation(Microinstruction,DB); //Memory Address Module Mem.Operation(Microinstruction,DB,MR); //Memory Address Module RG.Operation(Microinstruction,DB,PC,SP,AC,OP,ALU1); //Register File Module OP.Operation(Microinstruction,DB); //Operand Module PC.S_Operation(Microinstruction, DB); // Special PC Operation // FL.Operation(Microinstruction); //Flag Register Module (only to LPC) if (Microinstruction == "000000000000000000001000000000000000000000") break; clocks++; if (Print(mode,count_inst,ret_inst,Microinstruction , be) == false) return false; } return true; }
Spline::Spline(float* x, float* y, int n) { m_x = m_y = m_y2 = NULL; SetBreakPoints(x, y, n); }