tristate?

leedude
2007-12-22
2013-04-29
  • leedude
    leedude
    2007-12-22

    Hi, is there any way i could have a bidirectional pin in a subcircuit?

    great program btw, best logic simulator ive seen so far.

     
    • I would love to know the answer to this.  The answer is that certainly the software can support it.  I base this on the fact that the Logisim library contains a RAM chip with a D wire which can be both the input and the output to the memory.  Unfortunately, I can't figure out how to do this for any of my own components. 

      I tried modifying Pin.java (and PinAttributes.java and PinFactory.java) and got somewhere... but not far enough.  I was able to modify the Pin to have three states (In, Out, In-Out) and didn't break the existing functionality!  However, my In-Out pins don't work.  I'd be happy to send these modifications to someone who thinks they can finish it up.

       
    • Carl Burch
      Carl Burch
      2008-09-19

      There isn't a way to do this currently. I've seen some people simulate the effect by having two pins - one in, one out, which are connected within the subcircuit and in the outer circuit.

      The reason Logisim doesn't have the option for subcircuits but it does for some components such as RAM is that simulating subcircuits is entirely different from individual components such as RAM. The latter are coded in Java and don't rely on an engine. For subcircuits, though, Logisim has to simulate the transfer of information from the outer circuit into the subcircuit (or in the other direction). It doesn't do this information transfer exactly as it ought, and a consequence of this is that it can't really deal with in-out pins quite right.

      I've played with rebuilding the simulation engine from scratch, to extend the functionality in many ways that the current architecture prevents. Among other things, this includes handling the connections between subcircuits "right." Doing this is a major undertaking, and it's a bit difficult to wrap one's mind around all the pieces of code that interact. A major challenge in Logisim, as opposed to most other simulators of its sophistication level, is that the user can revamp the circuit during the simulation. That adds a *lot* of complexity.