Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

8 Bit Adder

Discussion in 'Community Creations' started by Shiliski, Sep 6, 2014.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Shiliski Apprentice Engineer

    Messages:
    290
    This is a simple 8-bit adder created with the new sensors used as logic gates.

    Input 2 numbers in binary, one in red and the other in blue, and then the binary representation of the sum will be displayed in green. Simple enough.

    http://steamcommunity.com/sharedfiles/filedetails/?id=310394224

    [​IMG]
     
  2. mastpayne Senior Engineer

    Messages:
    1,385
    Whew! I came here expecting to see a low-rez photo of a snake...

    Nice!
     
  3. Shiliski Apprentice Engineer

    Messages:
    290
    Bahahaha.
     
  4. Legofreak Apprentice Engineer

    Messages:
    244
    I just sub'd. I'm looking forward to seeing how you did the logic gates.

    Edit: I think I either broke it or its not working. I'm not getting the right sums...
     
  5. piddlefoot Senior Engineer

    Messages:
    1,182

    LOL !
     
  6. damnatus Junior Engineer

    Messages:
    948
    Can you explain what's the difference between your OR and AND gates? From what I've seen they do not differ in anything.. or do they?
     
  7. Neotician Apprentice Engineer

    Messages:
    440
    OR gates have a high output if either one or both of the inputs are high.
    AND gates will only have a high output if both inputs are high.
     
  8. damnatus Junior Engineer

    Messages:
    948
    I know what an AND or an OR is. I asked because I don't see a difference in his implementations of them.
     
  9. Shiliski Apprentice Engineer

    Messages:
    290
    Okay, an explanation of the AND gates and OR gates.

    The idea is that the output is based upon the velocity of the pistons. Outputs of 1 have a positive velocity, while outputs of 0 have a negative velocity.

    The only option I have for modifying that velocity in a helpful way without using a reverse is the "Increase/Decrease Velocity" command options for pistons. The commands ONLY work in increments of .5 m/s.

    So if a piston has a "default" speed of -0.7, and I increase the velocity by 0.5, then that's -0.2, which is still negative. This is how the AND gates work. You have to increase the velocity TWICE in order to get the piston's velocity to be positive (0.3 m/s) which in turn creates a 1 output.

    Meanwhile, the OR gate is basically the same thing as the AND gate... except with a higher default speed of -0.2 (or something around there). This makes it so that both input signals have to be 0 in order for the gate to produce 0 as output, which is what you want.


    Now, you might be wondering about how this affects the AND gates in the adder itself... Well actually, those "AND" gates that are used in the actual adder aren't real AND gates. See, the "AND" gate setup is for a binary gate, meaning that if it gets 2 or more signals it will produce output, but in the adder itself I'm using 3 inputs, so the "AND" gate isn't really calibrated to be an actual AND gate. I'm essentially exploiting a bug in my own AND gates to get the adder to work more efficiently. I'm sorry if this caused some confusion in how the gates actually work, as I was more focused on seeing if I could get it to work and therefore wasn't really thinking about how I was labeling stuff at the time.

    If you wanted a real AND gate using this method, you'd have to tune the "default" velocity of the piston to be something like... (-0.5*(n-1))+ -0.2 where n is the number of inputs, so a 3 gate AND would have a default speed of -1.2, 4 gates would be -1.7... and so on. The OR gate should remain at -0.2 for all numbers of inputs because no matter what you want it to be positive if at least one input is 1.

    So I hope that explains it. The only real difference between the AND and the OR gate that I used is the starting velocity of the piston.
     
Thread Status:
This last post in this thread was made more than 31 days old.