Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - Printable Version +- Forums - Open Redstone Engineers (https://forum.openredstone.org) +-- Forum: ORE General (https://forum.openredstone.org/forum-39.html) +--- Forum: Tutorials (https://forum.openredstone.org/forum-24.html) +---- Forum: Advanced Tutorials (https://forum.openredstone.org/forum-26.html) +----- Forum: Concepts (https://forum.openredstone.org/forum-28.html) +----- Thread: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] (/thread-1482.html) |
Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - AFtExploision - 12-04-2013 Note: This assumes you know binary logic gates and Ripple-Carry addition ------------------------------------------------------------------------ Carry Look-Everywhere Addition (CLE) is a Minecraft optimized carry-look ahead adder. But what is CLA (Carry Look-Ahead)? ------------------------------------------------------------------------ CLA is an adder that calculates carry at the same time as the sum, unlike RCA, where it is sum-carry rippling through the adders. The first component of CLA is the half-adder. This is just an XOR and AND gate on the same two input lines. We'll call the XOR's output Pn and the AND's output Gn where n is the number of the half-adder, starting at 0. So, we have the first part of the adder. Now how can we calculate sums with CLA using them? Well, lets start at the carry calculation. For the first bit, bit 0 (in computers you start counting at 0, not 1), the only possible way to get a carry input is through Cin. So, the sum for the first bit (S0) is: Code: S0 = P0 xor Cin Code: s0 = (A0 XOR B0) xor Cin In fact, the sum of bit 'n' is: Code: Sn = Pn xor C(n-1) So far, this is the same as RCA. What's the difference? The difference is how C, the carry is calculated. In RCA you need to calculate the bit before to get the carry value, but in CLA you can calculate the value of all carries at the same time. Using equations (where the terms are next to each other is AND, a + is OR) you can get C0: Code: C0 = P0Cin + G0 OK, so for CLA carry calculations you OR together all possible combinations. Sounds hard to keep track of it all? Well, here is the equation for bit 1... Code: C1 = P1P0Cin + P1G0 + G1 Code: C0 = P0Cin + G0 ---------------------------------------------------------------------- So, that is CLA. But what is CLE and why is it MC optimized? CLE is the exact same as in it follows the same logic, but different in that carries use the same line. Let me explain. In CLA, even though bit 0 and bit 1 both use the term 'Cin' to calculate their carries, there are different lines from Cin to the bits. In CLE, they use the same line. In this example, bit 0 would have P0Cin going into its carry line, but, with an instant diode or something of the sort. So then, we have a line for P0Cin. We add another instant diode (like glowstone) and wire it to bit 1. Here, we and P1 with P0Cin to git P1P0Cin. Because of the instant diode, it does not interfere with the calculations for bit 0's carry, and because of the instant diode from P0Cin to the carry line of bit 0, the rest of the possible carries does not interfere with P0Cin. This continues for the rest of the adder. Every new bit, one new term that can carry is added, but, we do the same for these. A practical way to do this is to Invert Cin, Invert P0, then use that line as the place for the instant diode to branch off. Then on bit 1, we connect an inverted P1 to the line and instant diode off to bit 2, and so on. Then, on each bit, we invert this signal to input to the carry line. This works on the idea that AND gates are just inverters, ORs, and another inverter. On the first bit, we invert the two inputs on the AND then or them. Next, we invert it to get P0 AND Cin. However, because we carry the inverted line, when we combine with P1 and invert for bit 1's carry line, we are basically making a big AND gate of P1, P0 and Cin that does not interfere with the first AND, and so on. ---------------------------------------------------------------------- Here is an example of the carries from Newomaster's CLE: The carry lines The inverted Cin, the only thing needed to calculate carry for bit 0 Using half-slab insta diodes to carry the inverted Cin up to other carry lines The gold block substitutes for P0. There is a torch on the other side to invert it and add it to the slab line. We do the same for the rest of the bits. Now, for the G0, which goes to the line for bit 1. This is the start, so the torch represents an inverted G0 going in. Now we do the slab tower and torches. Wait for what we do with these. Finish this up for the rest of the terms.... Here we connect the torches in the horizontals. This is because the horizontals are all the same 'Pn" term. This example is 4 bits, the 5th carry line is the Cout of the adder. We would XOR each of these lines with their respective P to get the sum. RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - newomaster - 12-04-2013 Nice explanation... although I'm much too lazy to read it right now. It looks very delicious though. RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - Jmking80 - 12-04-2013 Might be just me, but half for me I need to keep scrolling side ways to read everything. I find that rather annoying. Maybe you could thumbnail the pictures? But other then that very well explained. RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - AFtExploision - 12-23-2013 (12-04-2013, 04:52 PM)Jmking80 Wrote: Might be just me, but half for me I need to keep scrolling side ways to read everything. I find that rather annoying. Maybe you could thumbnail the pictures? But other then that very well explained. how do I do that exactly? NEED A TUTORIAL ASAP RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - Jmking80 - 12-23-2013 lol, just resize the images would suffice. And for the thumbnails, *glares at mort* RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - WrytXander - 12-24-2013 I am thankful, great tutorial, +1 RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - Kotov - 01-08-2015 coolt being coolt :3 RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - CreepyTacoMan - 01-09-2015 wat. This is more than a year old. Like, wat? RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - Magic :^) - 01-09-2015 (01-08-2015, 01:01 PM)Kotov Wrote: coolt being coolt :3 Aggreed xD RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - AFtExploision - 01-09-2015 My tutorial lives RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - Legofreak - 02-06-2015 am i going crazy or are those pictures for a 5 bit adder? RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - AFtExploision - 02-06-2015 It is 5 bit RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - Legofreak - 02-06-2015 (12-04-2013, 01:12 AM)AFtExploision Wrote: This example is 4 bits, the 5th carry line is the Cout of the adder. I just kept looking at it and thinking "why are there 6 carry lines then?" btw, took me long enough to want to take time to learn this, huh? RE: Carry Look-Everywhere Addition [Text + Images] [My first tutorial] - LordDecapo - 02-07-2015 Just saw this post for the first time cause of (^those bumbs) and I dropped an f bomb in one of those logs xD lol. I feel like a bk |