Fri May 25 19:10:21 EDT 2018
Added a fatal error for signals driven more than once.
Now, how to avoid this from happening by using a functional
Basically, create some kind of fix operator.
Again, a counter.
-- A counter from a register fixed point operator
counter' :: forall m r. RTL m r => r Sig -> m ()
counter' = regFix inc
regFix :: RTL m r => (r Sig -> m (r Sig)) -> r Sig -> m ()
regFix f r = f r >>= next r
So that's straightforward.
To create state machines it is still necessary to have a naked
'signal' that can set up the register in the first place.
Ok... so what's next?
I will have to represent state machines as functions with I/O.
E.g. two input, two output:
r Sig -> r Sig -> m (r Sig, r Sig)
For the code generator, open functions are definitely necessary, but
for the emulator it is ok to just work with traces for now. A test
bench doesn't need an input.