diff options
| author | Julian Blake Kongslie | 2022-10-17 17:54:53 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-17 17:54:53 -0700 |
| commit | 3f6b5e337b282bd8675a97e048e267e6f90ccec6 (patch) | |
| tree | 9efeef7b96bab709782fed2ccc40034a88810678 /isa | |
| parent | Faster IO model (until we determine how slow FOCAL needs to be) (diff) | |
| download | biggolf-3f6b5e337b282bd8675a97e048e267e6f90ccec6.tar.xz | |
Clean up address handling and change autoinc to preincrement
Diffstat (limited to 'isa')
| -rw-r--r-- | isa/checker.cpp | 6 | ||||
| -rw-r--r-- | isa/decode.cpp | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/isa/checker.cpp b/isa/checker.cpp index 7bca5c9..770d9d6 100644 --- a/isa/checker.cpp +++ b/isa/checker.cpp | |||
| @@ -17,8 +17,10 @@ void checker::execute() { | |||
| 17 | 17 | ||
| 18 | if (inst.need_indirect_load) { | 18 | if (inst.need_indirect_load) { |
| 19 | auto addr = mem.fetch(inst.init_address.value()); | 19 | auto addr = mem.fetch(inst.init_address.value()); |
| 20 | if (inst.need_autoinc_store) | 20 | if (inst.need_autoinc_store) { |
| 21 | mem.store(*inst.init_address, (addr + 1) & 07777); | 21 | addr = (addr + 1) & 07777; |
| 22 | mem.store(*inst.init_address, addr); | ||
| 23 | } | ||
| 22 | inst.final_address = addr; | 24 | inst.final_address = addr; |
| 23 | } else { | 25 | } else { |
| 24 | assert(!inst.need_autoinc_store); | 26 | assert(!inst.need_autoinc_store); |
diff --git a/isa/decode.cpp b/isa/decode.cpp index cb6a694..03e2225 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp | |||
| @@ -252,7 +252,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit | |||
| 252 | 252 | ||
| 253 | // Instructions with memory operands may be direct or indirect | 253 | // Instructions with memory operands may be direct or indirect |
| 254 | if (inst.need_exec_load || inst.need_exec_store || inst.possibly_redirects) { | 254 | if (inst.need_exec_load || inst.need_exec_store || inst.possibly_redirects) { |
| 255 | auto addr = (df << 12) | ((bits & 00200) ? (inst.next_pc & 07600) : 0) | (bits & 00177); | 255 | auto addr = (df << 12) | ((bits & 00200) ? (pc & 07600) : 0) | (bits & 00177); |
| 256 | if (bits & 00400) { | 256 | if (bits & 00400) { |
| 257 | inst.need_indirect_load = true; | 257 | inst.need_indirect_load = true; |
| 258 | inst.init_address = addr; | 258 | inst.init_address = addr; |
| @@ -262,7 +262,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit | |||
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | // Non-jump indirect memory operands may be autoincrementing depending on operand bits | 264 | // Non-jump indirect memory operands may be autoincrementing depending on operand bits |
| 265 | if (!inst.possibly_redirects && inst.need_indirect_load && ((bits & 00170) == 00010)) | 265 | if (!inst.possibly_redirects && inst.need_indirect_load && ((inst.init_address.value() & 07770) == 00010)) |
| 266 | inst.need_autoinc_store = true; | 266 | inst.need_autoinc_store = true; |
| 267 | 267 | ||
| 268 | return inst; | 268 | return inst; |
