[<<][rtl][>>][..]
Sat Jul 21 00:32:08 EDT 2018

Memories..

Something really strange is going on with memories.  There seems to be
some interference between the two feedback parts that do trace input
and memories.

I don't understand, so I wonder, why does it need to be so opaque?
Can other kinds of feedback be just the same as closeReg?

The reason I didn't do this is because registers get re-initialized
completely on every round.  But that isn't much different from being
otherwise updated..


closeProcess has this

  -- Compute update using the update function bundled with current
  -- state.  Repack with update function to do the same next time.
  o <- modifyProcess r p0 $ \(Process (s, u)) -> do
    (s', o) <- u s
    return (Process (s', u), o)

I think what happens is that the u in there calls modifyProcess again.

But it seems fine.  There was a bug in here before..  The inner
routine can call modifyProcess, as long as it is a different r.  Can
the r be the same?

modifyProcess r def f = do
  ps <- getProcesses
  let p = Map.findWithDefault def r ps
  (p', o) <- f p
  modify $ appProcesses $ insert r p'
  return o


Here's the routine.  It appears as if the closeMem captures the first
instance of the input.

-- This does something really strange
x_mem_bad = do
  let writes = [[0,1,x,x+20] | x <- [1..10]]
      reads  = [[x,0,0,0]    | x <- [1..10]]
      outs = t_mem $ writes ++ reads
      t_mem = trace [8,1,8,8] $ \i@[ra,we,wa,wd] -> do
        t <- stype wd
        SeqEmu.closeMem [t] $ \[rd] ->
          return ([(we, wa, wd, ra)], (rd:i))
  putStrLn "-- x_mem_bad rd,ra,we,wa,wd"
  printL outs


Why does it capture the first value?
I think I'm assuming that the update equation is constant.

Yes, it's passed from call to call.

That's the problem.

Trouble is that once the equation is tucked away, I can't use it any
more.

So the solution is to make the state typable.

EDIT: OK, works.



[Reply][About]
[<<][rtl][>>][..]