blob: 70b0f88180cc627dd6a3759cbf7c2be79890b797 (
plain) (
blame)
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
|
#include <cassert>
#include "isa/checker.h"
#include "isa/isa.h"
void funcchecker::execute() {
if (!ctlregs[HALTED]) {
inst = decode(ctlregs[FLAGS],
pc,
mem.fetch(pc),
interrupt);
auto next_pc = inst.next_pc;
if (inst.need_indirect_load) {
auto addr = mem.fetch(inst.init_address.value());
if (inst.need_autoinc_store) {
addr = (addr + 1) & 07777;
mem.store(*inst.init_address, addr);
}
auto df = (ctlregs[FLAGS] & FLAG_DF) >> FLAG_DF_SHIFT;
inst.final_address = (df << 12) | addr;
} else {
assert(!inst.need_autoinc_store);
}
if (inst.need_exec_load)
inst.data = mem.fetch(inst.final_address.value());
if (inst.need_read_acc)
inst.acc = acc;
if (inst.need_read_link)
inst.link = link;
if (inst.need_read_mq)
inst.mq = mq;
if (inst.read_ctlreg.has_value())
inst.ctlval = ctlregs[*inst.read_ctlreg];
inst.execute();
if (inst.need_write_acc)
acc = inst.acc.value();
if (inst.need_write_link)
link = inst.link.value();
if (inst.need_write_mq)
mq = inst.mq.value();
if (inst.write_ctlreg.has_value())
ctlregs[*inst.write_ctlreg] = inst.ctlval.value();
if (inst.need_exec_store)
mem.store(inst.final_address.value(), inst.data.value());
assert(inst.next_pc == next_pc || inst.possibly_redirects);
pc = inst.next_pc;
}
interrupt = system.interact(icount++, ctlregs, true);
}
|