next up previous
Next: Eliminate START and Up: MIT REVERSIBLE COMPUTING PROJECT Previous: New mechanism for

Merge Instruction and Data Memories

Currently the EXCH instruction is defined to access a special data memory that is separate from the instruction memory where programs reside. This makes it more or less impossible to write a full operating system including programs that compile, load, and execute other programs. It also makes it difficult to write programs that include data inline; there is no way for a program to even read instruction memory.

The solution is to merge the two memories. This does nothing strange unless an exchange instruction attempts to perform an exchange with its own address. What should happen? If the instruction were to actually change while being executed this would in general be irreversible.

A natural alternative behavior occurs if there is a special instruction register and the execution cycle works as follows:

1. Swap MEM[PC] <-> IR.
2. Execute instruction in IR. (May be an EXCH.)
3. Swap MEM[PC] <-> IR.
4. Update PC.

What will happen if step 2 does an EXCH with a memory location that happens to be MEM[PC]? The value it will read is the value that was in IR before step 1. The value it writes will end up in IR after step 3. The contents of MEM[PC] will be the same (namely the EXCH instruction) after step 3 as they were before step 1.

In other words, any instruction that tries to read/write itself instead effectively reads/writes a special variable (which we might call ``Itself'') which resides in IR between instructions, and in MEM[PC] during an instruction. Initially this variable will contain 0, and it will only change if some instruction actually tries to overwrite itself.

A simple loop of code that tries to make a copy of itself elsewhere in memory will instead produce a copy with a hole, but an extra EXCH instruction after the loop can fill in the hole.

This seems like behavior we can cope with, and it should be easy to implement, and it eliminates the separate memories, making true OS facilities possible.



next up previous
Next: Eliminate START and Up: MIT REVERSIBLE COMPUTING PROJECT Previous: New mechanism for



Michael Frank
Wed Jul 23 13:48:27 EDT 1997