-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstructionQueue.java
More file actions
42 lines (41 loc) · 1.24 KB
/
InstructionQueue.java
File metadata and controls
42 lines (41 loc) · 1.24 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
42
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package scoreboard;
import java.util.LinkedList;
/**
*
* @author lovelinanand
*/
public class InstructionQueue {
public LinkedList<Instructions> queue;;
private InstructionsList iTable;
public InstructionQueue() {
this.queue = new LinkedList<Instructions>();
}
public boolean canBeDispatched(Instructions inst){
return true;
}
public void dispatch(Instructions inst){
this.queue.add(inst);
inst.setDispatched();
}
public boolean isAntiDependant(Instructions inst){
boolean isAntiDependant = false;
for(Instructions nextIns: this.queue){
if(inst.lineCount <= nextIns.lineCount){
continue;
}
String Destination = inst.getDestination();
if(Destination.equals(nextIns.getSource1()) || Destination.equals(nextIns.getSource2())){
isAntiDependant = true;
}
}
return isAntiDependant;
}
public boolean removeIns(Instructions nextIns){
return this.queue.remove(nextIns);
}
}