Page 1 of 1

Multisignal Memory Unit with individual signal manipulation

Posted: Sat Jan 30, 2021 6:53 pm
by Redruin
Recently I have decided to embark on creating a programming interface with combinators, and the need for memory became naturally apparent. I originally was using this design here, but the unit would reset every signal whenever the set signal was on, meaning that if you only wanted to change one signal at a time you were out of luck. A way to deal with this is to use addressable memory (a la https://factorioprints.com/view/-LajOSCOyWMA45ORfdD8) but this adds the added complexity of keeping track of an address for specific values, and it means that if you want to change signals independently of one another you can only store one signal on each memory cell. This quickly causes memory to balloon, which is a shame considering the impressive amount of data you can store along a single wire. I'm pretty sure there are other encoding tricks as well, but I am not familiar with them, and only needed a "simple" device with the functionality I needed.

Hence, I designed this circuit here with the goal of allowing the modification of individual signals in a memory block in one single unit. It's not perfect by any means, this is the first contraption I've truly "made" with combinators, and it has a number of problems that I'm hoping the community might be able to fix where I cannot.

Image



Pros:
  • Can handle up to N-1 unique signals (where N is the total number of circuit network signals available)
  • Can handle the full range of numeric values, from INT_MAX to INT_MIN inclusive [-2147483648, 2147483647]
  • Can change not just one, but groups of selected signals to any value in batches
  • No need to handle extra signals for addresses, each signal's type is it's address
  • Simple interface; simply set the filter signal and the value you want and you're done
  • Builtin two-mode system: By changing the filter, you can toggle between setting and summing the signal in memory
Cons:
  • Inconsistent timings make using it with other non-clocked circuitry nigh impossible
How to use it
How it works
Problems:
By my measurements, the machine takes 3 ticks to reset its memory (set/reset pulse) and 7 ticks to change its filter (modifying green wire) for a potential fastest turnaround of 7 ticks. This isn't ideal not only because of no one-pulse compatibility, but also because having different pulses at different lengths results in different behavior:
  1. if the pulsed inputs are less than 3 ticks, the memory is completely wiped
  2. if the pulsed inputs are less than 7 ticks, all the values on the input wire are summed to memory regardless of the filter contents
Since the filter part takes up the majority of the time to run, I made a different version that's more compact without the filtering apparatus. This design requires only 3 ticks to execute, though it still a not quite ideal. In this one all values are set as deltas, so if you want to change a number to a specific value, you have to calculate the difference between the current value elsewhere, which can make things more complicated. I think I can work around this though, so if theres any way to get this down to 1 tick pulses I'm all ears.

Image



It would also be acceptable to have an output delay as long as the input produces the correct output; meaning the input could be pulsed and then some ticks later the correct output arrives. I figured that I would submit this design to the forums to see if anyone had any suggestions or fixes. I have the sneaking suspicion that I've made this whole thing far more complex than it needs to be...