Archive for March, 2008

for-loops - break and continue

Bwain| No Comments »

I *think* I have for-loops fully working. I can’t come up with an expression that breaks it. So the last two features to implement are ‘break’ and ‘continue’. Continue seems easier with the current architecture. Just need to disable the proc until the current loop finishes. ‘break’ seems a bit more difficult. Break will permenantly disable a proc for the duration of the current loop. I’m not certain that the current architecture will support this.

In any case, it will be easier to test continue/break after implementing if/then/else.

  • exec test -> boolTmp
  • deact neg threads
  • if (boolTmp==all false) then {jmp else-clause:}
    • execute if section
  • else-clause:
  • flip boolTmp. deact neg threads, act pos threads
  • if (boolTmp==all false) then { jmp endif:}
    • execute else section
  • endif:
  • activate neg threads

So we need 3 assembly commands. We should be able to generate all three from a template.

  1. deactivate threads if tmp = false. branch if all false
  2. deactivate/activate threads if tmp = true/false. branch if all true
  3. activate threads if tmp=false

Very good guess. I was testing the vex compiler, it seems to do something very similar. 1,2,3 are if,else,endif, respectively.

I’ve got if-then-else working. I keep having to come up with ways to break it, but its passing so far….


For loops redux

Bwain| No Comments »

I’ve found a better way to implement for-loops. I’m using 2 tmp boolean variables, doing for-break only requires one. If the for loop has a ‘continue’ statement, then we require another boolean. The processors get disabled on the ‘continue’ statement, then get re-enabled before looping back to the top. The 2nd tmp boolean would be required to keep track of which processors to be re-enabled.

if-then-else statements are pretty solid. I’ve been trying to break them all week, and it seems like they’re fully implemented.


Copyright © 2010 Luna-Canis | Created by miloIIIIVII
Top | Sidebar | Sitemap | Disclaimer | Network