4-Bit Ripple Carry Adder

Dr_DerpDr_Derp tejasMember Posts: 775
If you do not understand what is going on, have a read at this discussion first!
http://forums.deepworldgame.com/discussion/26550/how-2-logic-gates-properly#latest

Now then, as promised, a tutorial for a 4-Bit Ripple Carry Adder. This is a bit advanced, but if you understood the discussion above, then you should probably be good to go.

Note, this is by far not even close to being a good and optimized creation, I spaced everything out in order to make it easier to draw in the connectivity lines. You can most definitely make it more compact and faster as well.

A look back to the previous discussion, if you remember the full adder circuit, you will note it has 3 inputs. A, B, and a carry input. The circuit has two outputs, one being a true output and the other being a carry output. The way a ripple carry adder works is you have multiple full adders and connect the carry output to the next carry input. With this in mind, you can go a lot higher than 4-Bit by simply chaining more full adders, but expect a slower output as you go higher in bit count.

Before starting the design, it is important to note that because the first full adder does not and will not ever get a signal from its carry input, you can remove it altogether and use a half adder, which is much more compact, do note that you can only do this for the FIRST adder, and only the first.

Using the designs, but a bit spaced out, I created this structure for the circuit, this is where the logic is going to be placed.
image
As you can see, I reflected the adder in order to save the racer travel time.

Go somewhere, and set up a control panel, like this.
image
There is a good reason we have 5 signs for an output. A 4 bit number can be as high as 15, so adding two 4 bit numbers could result in a value as high as 30, and a 4 bit number cannot hold a value above 15. That's why we use 5 signs, for 5 bits of potential output.

Now lets hook up the first adder to its switches and its sign. Make sure to type a "1" in the output touchplate.
image
This first adder is pretty straight forward.

Now, lets connect all of the carry outputs to the next carry inputs.
image

Next, connect the second adder to its switches.
image

And the third adder.
image

And finally the fourth adder.
image

Lets now connect the first XOR gate in the three full adders.
image

And the second XOR gate, which is actually the true output gate.
image

Now to finish up the gates, here is the two AND gates, we have already connected the OR gates' outputs so don't worry about that.
image

This is the most important part, you WILL need a reset switch as some trapdoors are triggered by levers and touchplates, as such, they will be difficult to properly reset, the easiest solution is just to have a large timed lever at one second connected to all trapdoors. Additionally, you can use this large timed lever to reset the output signs to say 0.
image

And I believe that is it, well, except for the spawner, and that has a pretty obvious spot. (it goes at the start of the first adder)
I apologize for some of the darker screenshots, but you should still be able to see what goes where.

If you haven't figured it out, the output is also in binary, but I will leave it to you to find out how to translate binary to decimal. :D
structure.png
1307 x 773 - 949K
controls.png
1457 x 828 - 797K
first adder.png
1535 x 598 - 679K
carry out to next in.png
1419 x 903 - 1M
second adder.png
1476 x 537 - 727K
third adder.png
1458 x 908 - 984K
fourth adder.png
1524 x 895 - 882K
first xor gate.png
1398 x 798 - 949K
second xor gate.png
1394 x 998 - 1M
and gates.png
1354 x 736 - 916K
reset switch.png
1496 x 1013 - 1M

Comments

  • SetenSeten The city of England.Member Posts: 375
    Clapclapclapclapclapclapclapclapclapclapclapclapclapclapclapclapclapclapclapclapclapclap
    Proud of you!
  • _Brainstorm__Brainstorm_ Nowhere and EverywhereMember Posts: 3,436
    Oh, this... must be cooler than the previous one, I like the mechanical expertise
  • Tannerman14Tannerman14 OblivionMember Posts: 2,215
    Keep these coming!! I love them!!!! Always wanted to get into the mechanical part of deepworld but never knew how.
  • EverywhenEverywhen Make someone happy todayMember, Arbiter Posts: 4,695
    Whoahhhh :)
    This is awesome
Sign In or Register to comment.