Implement accumL with newPulse - #260
Conversation
|
I'm not 100% clear on what's going on but I trust that this makes things better. At the very least I can see how this allocates one fewer latch nodes, so that seems good.
A few questions - mostly permutations of the same question, really - where are we retaining the previous state? Do you mean in memory somewhere, due to laziness or something? (Like, does the |
|
It's a tricky one to explain, but lemme try again 😄 First, the setup:
Now, let's look at what happens when
The state after network evaluation is now:
Does that help?
It's the first, but single-step is a bit ambiguous. It's a single step leak on
Also just to clarify, this is not a problem with laziness.
This is correct, but only for the latch I should also note that this is part of the problem described by #259. |
|
Thanks for catching this and sorry for taking so long to take a look at this -- work. 🤪 I agree with you, @ocharles
I approve, feel free to merge. 🙏🏻 |
|
@HeinrichApfelmus You need a job like mine where |
|
Whoa, who's hiring banana engineers?! |
|
CircuitHub 😎 But not hiring at the moment unfortunately 😞 |
If they feel the need to hire again — you know where to find us. 😉 |
Currently
accumLusesmapLto read the previous state whenever the state updatePulsefires. This is problematic, because when the previous state is read inmapL(and transformed into a(a -> a) -> afunction), this is cached into theLatch. This means that when the state updatePulsefires, we'll update one latch to the new state, while also retaining the previous state. This commit redefinesaccumLas a call tonewLatch(as before) and creates a newPulsewithnewPulsewhose evaluation function reads thePulsecontaining thea -> aendmorphism, and also reads the current state from its latch. With this implementation, no historic values are leaked byaccumL.