Tue Apr 2 19:31:35 EDT 2013

State machine setup

The code is ugly.  How to go about doing this in a cleaner way?

Semantically, what I want is a computation that is executed only at

_ r2;
for (t=0; t<t_endx; t++) {
    _ r1 = ...;
    _ r2 = ...;
    if (t == 0) {
        r3 = f(r2);
    _ r4 = f(r3);
    out[t] = r4;

it might be simpler to annotate those nodes directly, and just unroll
the loop once

_ t = 0;
_ r1 = ...;
_ r2 = ...;
_ r3 = ...;
_ r4 = ...;

for (t=0; t<t_endx; t++) {
    _ r1 = ...;
    _ r2 = ...;
    // not updating r3
    _ r4 = ...;

This would probably allow much of that hackery to disappear.  I.e. no
need to handle the state any different.  While it is not as efficient
as could be, if the output is not written in the preamble, there will
probably be a couple of dead nodes that can be eliminated by the C

So how to handle this?  It needs annotation, or a primitive p_hold.

No, not a primitive.  This needs some kind of node analysis.  Is a
node a constant?

It is if
- it depends only on other constants

A parameter is a constant.  These could be annotated explicitly to
distinguish them from signals.

Constant annotation could be done as a form of type-inference.

Maybe this should just be unified with the other constant annotation
thing that's not too clearly implemented?

Roadmap: this can be implemented along side the other implementation.
Once stable, the old could be deleted.

Still, it doesn't do state...

Idea isn't ready yet.

A simple if statement and stateful updates would be so easy!  Why does
this have to be so hard then?  Probably just not getting it..