-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEX.java
More file actions
41 lines (37 loc) · 1.55 KB
/
Copy pathEX.java
File metadata and controls
41 lines (37 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package simulator;
public class EX
{
public static void execute(int instructionNum,int cycleNumber)
{
String executePath = "";
String instruction=Simulator.memory[instructionNum][1];
if(instruction.matches("MUL.D"))
executePath = "FP Mult";
else if(instruction.matches("DIV.D"))
executePath = "FP Divide";
else if(instruction.matches("ADD.D") || instruction.matches("SUB.D") )
{
executePath = "FP Add";
}
else if(instruction.matches("LW") || instruction.matches("SW") ||
instruction.matches("L.D") || instruction.matches("S.D") )
{
executePath = "Memory Instruction" ;
}
else
executePath = "Integer Instruction";
switch(executePath)
{
case "Integer Instruction": Simulator.executeStage[instructionNum]=cycleNumber + 1-1;
break;
case "Memory Instruction": Simulator.executeStage[instructionNum] = Simulator.cache.dAccess(instructionNum, cycleNumber) - 1;//cycleNumber + Simulator.memoryCycle -1;
break;//Simulator.cache.dAccess(instructionNum, cycleNumber) - 1;
case "FP Add": Simulator.executeStage[instructionNum]=cycleNumber + Simulator.FPadder -1;
break;
case "FP Mult": Simulator.executeStage[instructionNum]=cycleNumber + Simulator.FPmultiplier -1;
break;
case "FP Divide": Simulator.executeStage[instructionNum]=cycleNumber + Simulator.FPdivider -1;
break;
}
}
}