Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calls should only preserve DC0 (except interrupts) while calling, loops should have an infinite loop type, and loops should use the same stack, systems, and instructions #4

Open
vadixidav opened this issue Jul 31, 2016 · 1 comment

Comments

@vadixidav
Copy link
Member

vadixidav commented Jul 31, 2016

When the processor makes a call, it should preserve only DC0, except for an interrupt which will preserve the addresses, directions, and values of DC1-3. This eliminates the prefetch dilemma encountered when using static ram and several issues which prevented parameters from being passed via DCs and DCs from being used for persistent stacks without excessive tracking of which functions overwrote the DCs (which still didn't permit moving the stack down multiple words at once).

The processor should also use the same systems between calling and loops. Theoretically speaking, a loop should never begin and end outside of the same function, and several loops mechanisms and calling mechanisms carry over perfectly after calls only preserve DC0:

  • return -> break
  • recursive tail call -> continue
  • call -> infinite loop with end location at next PC

This will allow infinite loops to be added, hardware to be reduced, and the call/loop stack to be significantly extended without sacrificing anything.

@vadixidav
Copy link
Member Author

vadixidav commented Jul 31, 2016

To achieve this loops should be implemented such that their program is stored inline, but their immediate values are stored in a different location so that, at the loops end, DC0 is restored to the next location from before the loop. If this were not the case, the location to set DC0 to after a call/loop would have to be stored. This effectively makes the return DC0 inferred the same regardless of if a call is being used or not, and it solves the break DC0 loading problem that was previously an issue by making it inferrable. Loop ends can still properly return the DC0 since DC0 always returns to that location. Therefore a loop can be operated without any instruction overhead at all, including overhead for handling the index if that can be optimized out.

It is also necessary to have an instruction for opening loops (inferred program, defined data, defined end) and calling (defined program, inferred data, inferred end).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant