本文整理汇总了C++中Accumulator::S_Operation方法的典型用法代码示例。如果您正苦于以下问题:C++ Accumulator::S_Operation方法的具体用法?C++ Accumulator::S_Operation怎么用?C++ Accumulator::S_Operation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accumulator
的用法示例。
在下文中一共展示了Accumulator::S_Operation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EXECUTE
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;
}