-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstruction.java
168 lines (144 loc) · 3.48 KB
/
instruction.java
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
public class instruction {
private String instruc_type;
private String opcode = "000000";
private String rs = "00000";
private String rt = "00000";
private String rd = "00000";
private String shamt = "00000";
private String function = "000000";
private String immediate;
private String jump_address;
// private String instruc_type;
// private String opcode;
// private String rs ;
// private String rt;
// private String rd ;
// private String shamt;
// private String function;
// private String immediate;
// private String jump_address;
public String print() {
//System.out.println(this.instruc_type);
String final_str = " ";
if (this.instruc_type == "r") {
final_str = this.opcode + " " + this.rs + " " + this.rt + " " + this.rd + " " + this.shamt+ " " + this.function;
}
else if (this.instruc_type == "i") {
final_str = this.opcode + " " + this.rs + " " + this.rt + " " + this.immediate;
}
else {
final_str = this.opcode + " " + this.jump_address;
}
//System.out.println(final_str);
return final_str;
}
//ALL SETTERS AND GETTERS BELOW
/**
* @return String return the instruc_type
*/
public String getInstruc_type() {
return instruc_type;
}
/**
* @param instruc_type the instruc_type to set
*/
public void setInstruc_type(String instruc_type) {
this.instruc_type = instruc_type;
}
/**
* @return String return the opcode
*/
public String getOpcode() {
return opcode;
}
/**
* @param opcode the opcode to set
*/
public void setOpcode(String opcode) {
this.opcode = opcode;
}
/**
* @return String return the rs
*/
public String getRs() {
return rs;
}
/**
* @param rs the rs to set
*/
public void setRs(String rs) {
this.rs = rs;
}
/**
* @return String return the rt
*/
public String getRt() {
return rt;
}
/**
* @param rt the rt to set
*/
public void setRt(String rt) {
this.rt = rt;
}
/**
* @return String return the rd
*/
public String getRd() {
return rd;
}
/**
* @param rd the rd to set
*/
public void setRd(String rd) {
this.rd = rd;
}
/**
* @return String return the shamt
*/
public String getShamt() {
return shamt;
}
/**
* @param shamt the shamt to set
*/
public void setShamt(String shamt) {
this.shamt = shamt;
}
/**
* @return String return the function
*/
public String getFunction() {
return function;
}
/**
* @param function the function to set
*/
public void setFunction(String function) {
this.function = function;
}
/**
* @return String return the immediate
*/
public String getImmediate() {
return immediate;
}
/**
* @param immediate the immediate to set
*/
public void setImmediate(String immediate) {
this.immediate = immediate;
}
/**
* @return String return the jump_address
*/
public String getJump_address() {
return jump_address;
}
/**
* @param jump_address the jump_address to set
*/
public void setJump_address(String jump_address) {
this.jump_address = jump_address;
}
}