summaryrefslogtreecommitdiff
path: root/isa/decode.cpp
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-11-01 09:18:50 -0700
committerJulian Blake Kongslie2022-11-01 09:18:50 -0700
commita599aa782028dfc9e8b1fd63c2971e53a13f77e6 (patch)
tree2ecfde3ceffb4d55dec51682d3d1a2086a4e8a2c /isa/decode.cpp
parentFix FLAGS bit handling by IO model (diff)
downloadbiggolf-a599aa782028dfc9e8b1fd63c2971e53a13f77e6.tar.xz
Implemented the remaining instructions required for echo_optimal.
Diffstat (limited to 'isa/decode.cpp')
-rw-r--r--isa/decode.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/isa/decode.cpp b/isa/decode.cpp
index c52780c..77bbe8b 100644
--- a/isa/decode.cpp
+++ b/isa/decode.cpp
@@ -130,9 +130,20 @@ instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned i
130 break; 130 break;
131 case 5: 131 case 5:
132 // RTF restore flags 132 // RTF restore flags
133 inst.read_ctlreg = FLAGS;
134 inst.need_read_acc = true;
135 inst.need_write_link = true;
136 inst.write_ctlreg = FLAGS;
133 inst.ef = [](auto &ctx) { 137 inst.ef = [](auto &ctx) {
134 std::cerr << "unimplemented RTF\n"; 138 if ((ctx.ctlval.value() & FLAG_INT_ENABLE) && (ctx.acc.value() & FLAG_INT_ENABLE)) {
135 assert(false); 139 ctx.ctlval = ctx.acc.value() | FLAG_INT_ENABLE_DELAY;
140 } else if (ctx.acc.value() & FLAG_INT_ENABLE) {
141 ctx.ctlval = (ctx.acc.value() | FLAG_INT_ENABLE_DELAY) & ~FLAG_INT_ENABLE;
142 } else {
143 ctx.ctlval = ctx.acc.value();
144 }
145 ctx.link = ctx.ctlval.value() & (1 << 11);
146 ctx.ctlval.value() &= ~(1 << 11);
136 }; 147 };
137 break; 148 break;
138 case 6: 149 case 6:
@@ -258,6 +269,35 @@ instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned i
258 }; 269 };
259 } 270 }
260 break; 271 break;
272 case 020:
273 case 021:
274 case 022:
275 case 023:
276 case 024:
277 case 025:
278 case 026:
279 case 027:
280 // MEMORY MANAGEMENT
281 {
282 auto field = (bits >> 3) & 07;
283 switch (bits & 07) {
284 case 01:
285 // CDF change data field
286 inst.read_ctlreg = FLAGS;
287 inst.write_ctlreg = FLAGS;
288 inst.ef = [field](auto &ctx) {
289 ctx.ctlval.value() &= ~FLAG_DF;
290 ctx.ctlval.value() |= field << FLAG_DF_SHIFT;
291 };
292 break;
293 default:
294 inst.ef = [bits, field](auto &ctx) {
295 std::cerr << "unimplemented IOT MEMORY suboperation " << (bits & 07) << " upon field " << field << "\n";
296 assert(false);
297 };
298 }
299 }
300 break;
261 default: 301 default:
262 inst.ef = [bits](auto &ctx) { 302 inst.ef = [bits](auto &ctx) {
263 std::cerr << "unimplemented IOT device " << ((bits >> 6) & 07) << ((bits >> 3) & 07) << " suboperation " << (bits & 07) << "\n"; 303 std::cerr << "unimplemented IOT device " << ((bits >> 6) & 07) << ((bits >> 3) & 07) << " suboperation " << (bits & 07) << "\n";