- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
Difference between revisions of "User:Jjdorf/Logic Gates"
(More notes...) |
(Additions to the Buffer gate TODO section, Added pre-toggling mechanical gates, re-arranged/clarified intro paragraph.) |
||
Line 1: | Line 1: | ||
− | I'll be using this as a spot to keep all my preferred logic designs in one spot. Each design will specify the power requirements, build materials (excluding walls if constructing rather than digging), and build order, including the points when an input or output needs to be hooked up to things. For the most part, I will be using [[DF2010:Mechanical logic]] for my basic logic gates, due to the fact that I want to completely avoid the need for an infinite water source. | + | I'll be using this as a spot to keep all my preferred logic designs in one spot. Each design will specify the power requirements, build materials (excluding walls if constructing rather than digging), and build order, including the points when an input or output needs to be hooked up to things. I consider gate technology in DF to be of two major types, Fluid Logic (FL), and Mechanical Logic (ML). Borg logic, while interesting and certainly amusing, I believe to have too much of an impracticality in pathfinding cost and a lack of precision; Thus, I will generally disregard it until more intrepid scientists prove my biased assumptions incorrect. For the most part, I will be using [[DF2010:Mechanical logic]] for my basic logic gates, due to the fact that I want to completely avoid the need for an infinite water source. The exception to this restriction lies in two gates (so far), and these exceptions occur for a simply reason: they have variants which do not lose water. |
− | ==Buffer/Rotation Sensor== | + | |
+ | ==FL Buffer/Rotation Sensor== | ||
Modified slightly from: [[DF2010:Mechanical logic]] | Modified slightly from: [[DF2010:Mechanical logic]] | ||
Line 28: | Line 29: | ||
===Inverter=== | ===Inverter=== | ||
An inverter can be built with identical properties and build sequence by simply changing the pressure plate to trigger on 4-7 water. | An inverter can be built with identical properties and build sequence by simply changing the pressure plate to trigger on 4-7 water. | ||
+ | ===Hybrid=== | ||
+ | Technically, this gate is designed for use solely in a hybrid environment, as the end result of a mechanical logic gear chain. If intended to be used completely as Fluid logic, the source would be converted to a power input, moved to the side of the pump instead of over the source tile, a hatch would be placed over the source tile, defaulting to closed when off. | ||
===Notes=== | ===Notes=== | ||
A Rotation sensor can also be considered a simple Buffer. Buffers in actual electronics circuits are often used to increase the number of gates an output signal can be connected to, often by much more than the standard gate output can do. Thus, I consider mechanical logic and fluid logic to be two different types of gates, and you use the gate that is best suited for the specific job. Since fluid logic has a greater ''fan-out'' than mechanical logic, the fluid buffer can reset the power needed, since fundamentally, multiple mechanical gates '''can''' be connected together without issue until power runs out or you need to use load gear assemblies such as in an XOR or XNOR gate. | A Rotation sensor can also be considered a simple Buffer. Buffers in actual electronics circuits are often used to increase the number of gates an output signal can be connected to, often by much more than the standard gate output can do. Thus, I consider mechanical logic and fluid logic to be two different types of gates, and you use the gate that is best suited for the specific job. Since fluid logic has a greater ''fan-out'' than mechanical logic, the fluid buffer can reset the power needed, since fundamentally, multiple mechanical gates '''can''' be connected together without issue until power runs out or you need to use load gear assemblies such as in an XOR or XNOR gate. | ||
===TODO=== | ===TODO=== | ||
− | Verify that a signal gear or axle can be placed at (S) and still allow water to be pumped. If this is not possible, adjust the design to put the gear one z-level above the pump, making sure to channel the floor to allow power transfer. | + | Verify that a signal gear or axle can be placed at (S) and still allow water to be pumped. If this is not possible, adjust the design to put the gear one z-level above the pump, making sure to channel the floor to allow power transfer. Construct and build a prototype and leave it run for a long time to verify the claim of no evaporation. Dwarf Science! |
===Pros/Cons=== | ===Pros/Cons=== | ||
The pressure plate requires 100 steps to switch off, but switches on immediately. The sensor is water tight and should not evaporate under normal operation, allowing it to be disconnected from an infinite water source. | The pressure plate requires 100 steps to switch off, but switches on immediately. The sensor is water tight and should not evaporate under normal operation, allowing it to be disconnected from an infinite water source. | ||
Line 37: | Line 40: | ||
When the source gear or axle is disabled, so will the pump be. In this state, the water level in the bottom reservoir will be a constant 7/7, thus disabling the pressure plate (set to 0-3). When the pump turns on, however, it pumps from the pressure plate tile constantly. Thus will shift the water in that tile to the rear reservoir in the top level, keeping the plate clear of water, thus triggering the plate. Since no tile of water will ever be less than 2/7 water at any time, no evaporation is possible (theoretically). | When the source gear or axle is disabled, so will the pump be. In this state, the water level in the bottom reservoir will be a constant 7/7, thus disabling the pressure plate (set to 0-3). When the pump turns on, however, it pumps from the pressure plate tile constantly. Thus will shift the water in that tile to the rear reservoir in the top level, keeping the plate clear of water, thus triggering the plate. Since no tile of water will ever be less than 2/7 water at any time, no evaporation is possible (theoretically). | ||
− | ==RAM== | + | ==FL RAM== |
Random Access Memory, basic cell structure: | Random Access Memory, basic cell structure: | ||
Line 81: | Line 84: | ||
This memory cell design is almost identical to a standard RS Flip-Flop circuit. The exceptions are that it only provides one output, and the SET and RESET signals are default HIGH (on) in the electrical version. The implementation is also somewhat different as well, but that is not particularly important. | This memory cell design is almost identical to a standard RS Flip-Flop circuit. The exceptions are that it only provides one output, and the SET and RESET signals are default HIGH (on) in the electrical version. The implementation is also somewhat different as well, but that is not particularly important. | ||
− | ==RAM Byte (Including Power Supply)== | + | ==FL RAM Byte (Including Power Supply)== |
An extension of the above, with an expanded Dwarven Water Reactor to provide power. | An extension of the above, with an expanded Dwarven Water Reactor to provide power. | ||
Line 105: | Line 108: | ||
===Notes=== | ===Notes=== | ||
− | The Water Reactor used here will provide exactly 250 excess power. The memory cells themselves will cost 160, leaving 90 for the power train. The power train consists of two gears and 9 axle tiles, for 19 power, leaving 71 | + | The Water Reactor used here will provide exactly 250 excess power. The memory cells themselves will cost 160, leaving 90 for the power train. The power train consists of two gears and 9 axle tiles, for 19 power, leaving 71 surplus power. The output gears are not considered part of the power train, as they will typically be used in other logic circuits, and will likely need more than 71 power to run whatever they are intended for. This leaves that power for other applications as needed. |
+ | |||
+ | =Custom Mechanical Gates= | ||
+ | In light of the fact that Gears are toggled, not set or unset, I am looking into the concept of more efficient designs for certain mechanical gates. The hope is that the excessive load gear trains for certain gates can be eliminated, providing upper boundaries on power usage, and making power source designs less complicated. For completeness I will also show the designs for unaffected gates. In the diagrams for Mechanical Logic gates, power sources and outputs may be gears, axles, or direct connections to a pump in the case of outputs. Sometimes it will be necessary for the power to be an extra gear. Power train and output train design are secondary and much simpler concerns. In the diagrams, capital letters indicate a normally constructed gear assembly, while miniscule letters indicate a gear assembly that is toggled once after construction with a lever. | ||
+ | |||
+ | ==WARNING!!!== | ||
+ | I have '''''NOT'''''' yet tested these gates. The gates that require pre-toggled gears are theoretical at this point, though I intend to test them in the next day or so. | ||
+ | |||
+ | ==ML Buffer== | ||
+ | Essentially this is an identity gate. It is the simplest ML gate possible, using at least one gear assembly to transfer power. It is, essentially, the reverse of the rotation sensor, taking a linked signal and converting it to P - 5 power. | ||
+ | |||
+ | PIO | ||
+ | |||
+ | Power is supplied (P), and if the input gear is functional (I), then the power, less 5 for the input gear, will be transferred to the output (O). Construction is simple, make the gear assembly and link to the signal. | ||
+ | |||
+ | ==ML Inverter (NOT)== | ||
+ | This is similar to an identity gate. It is even constructed in a similar fashion, though you must also add a lever and pre-toggle the Input gear. | ||
+ | |||
+ | PiO | ||
+ | |||
+ | In all ML schematics, a lower case gear spot will indicate that it is pre toggled via a lever. Here, Power is supplied (P), and if the input gear is functional (i), then the power, less 5 for the input gear, is transferred to the output (O). Construction is simple, make the gear assembly and a lever. Link the gear assembly to the input signal, the lever to the gear, then flip the lever once. Optionally destroy the lever to recover two mechanisms. | ||
+ | |||
+ | ==ML AND Gate== | ||
+ | Much like an ML Buffer gate. Two gears instead of one, and both must be active to function. | ||
+ | |||
+ | PABO | ||
+ | |||
+ | Power is supplied (P), and if both input gears are functional (A & B), then the power, less 10 for the gears, will be transferred to the output (O). Construction is simple, make the gear assemblies and link them to their respective signals. | ||
+ | |||
+ | ==ML OR Gate== | ||
+ | Slightly more complex than the preceding ML gates, but still relatively easy. Again, there are two inputs. However, only one needs to be active for the result to be true. | ||
+ | |||
+ | PA | ||
+ | BO | ||
+ | |||
+ | Essentially, this is two separate identity paths from power to output. As long as the power is available, either one can provide the needed power to output. Power is supplied (P), and if either input gears are functional (A & B), then the power, less up to 10 for the gears, will be transferred to the output (O). Construction is simple, make the gear assemblies and link them to their respective inputs. Of particular importance is the fact that this gate can potentially be constructed one tile wide and two z-levels high, if the top layer is channeled out and the bottom layer is built first for safety reasons. | ||
+ | |||
+ | ==ML NOR Gate== | ||
+ | Taking advantage of the ability to pre-toggle gears, a simple NOR gate can be constructed with almost no difficulty. | ||
+ | |||
+ | PabO | ||
+ | |||
+ | Power is supplied (P), and if both input gears are functional (a & b), then the power, less 10 for the gears, will be transferred to the output (O). Construction is mild, make the gear assemblies, construct two levers, link the levers to the gears, flip both levers, optionally dismantle the levers to recover mechanisms, then link the inputs to their sources. It works as a NOR gate because we invert the inputs. | ||
+ | |||
+ | ==ML NAND Gate== | ||
+ | Again, taking advantage of the ability to pre-toggle gears, we can build a NAND gate without the need for a load gear train to overload power. | ||
+ | |||
+ | Pa | ||
+ | bO | ||
+ | |||
+ | Power is supplied (P), and if both input gears are functional (a & b), then the power, less up to 10 for the gears, will be transferred to the output (O). Construction is mild, following the same build order as for a NOR gate, though the layout is different. As with the NOR gate, it works because of the pre-toggled gears. Of particular importance is the fact that this gate can potentially be constructed one tile wide and two z-levels high, if the top layer is channeled out and the bottom layer is built first for safety reasons. | ||
+ | |||
+ | ==ML XOR Gate== | ||
+ | XOR, or Exclusive OR, is much like an OR gate, except that it only activates when only one input is active. | ||
+ | |||
+ | P-A | ||
+ | | b | ||
+ | BaO | ||
+ | |||
+ | This operates on the principle that XOR = (A AND NOT B) OR (B AND NOT A). Because we can pre-toggle gears, we can input an implied NOT operation. The resulting AND and OR ops are simple copies from above. This gate requires a bit more space, but not nearly as much as would be needed if a drain load were used. If one is willing to have the design require more power and two z-levels, it can be built with two pathways on top of each other, taking advantage of the fact that power doesn't transfer from floor to floor without channeling. | ||
+ | |||
+ | From the side: | ||
+ | |||
+ | *Ab* | ||
+ | PaBO | ||
+ | |||
+ | Channels would only be present between the Power (P) and Output(O) tiles, and the tiles above them (or below if you swap layers). The inputs (A, B, a, & b) provide pathways from the power to the output. Depending on where the power source is, the power drain at any state will be in the range of 10 to 20 units of power. If the power source is designed to '''not''' be on the same z-level of the output, the power drain will always be 15 when the XOR function evals to true. |
Revision as of 05:46, 23 April 2010
I'll be using this as a spot to keep all my preferred logic designs in one spot. Each design will specify the power requirements, build materials (excluding walls if constructing rather than digging), and build order, including the points when an input or output needs to be hooked up to things. I consider gate technology in DF to be of two major types, Fluid Logic (FL), and Mechanical Logic (ML). Borg logic, while interesting and certainly amusing, I believe to have too much of an impracticality in pathfinding cost and a lack of precision; Thus, I will generally disregard it until more intrepid scientists prove my biased assumptions incorrect. For the most part, I will be using DF2010:Mechanical logic for my basic logic gates, due to the fact that I want to completely avoid the need for an infinite water source. The exception to this restriction lies in two gates (so far), and these exceptions occur for a simply reason: they have variants which do not lose water.
FL Buffer/Rotation Sensor
Modified slightly from: DF2010:Mechanical logic
XXX XXX S%>#D . . XXX XXX XXXXXX XXXXXX Xo D Xo D XXXXXX XXXXXX
Both doors (D) are ordinarily forbidden under normal operation. A water drain path is a good idea if maintenance is ever necessary on the bottom floor. The mechanical input (S) provides the power to the pump. Enough power must be available at this point to drive the pump (10 units) when the signal gear or axle is functioning. The pressure plate (o) on the bottom layer is set to 0-3 water level. The screw pump (%>) pumps away from the signal mechanism, towards a floor grate (#).
Building
- First, construct or dig the walls and floors. If constructing, do NOT build floors at the empty space tiles (.), channel the same tiles if digging from the rock.
- Build the pressure plate on the bottom layer, then link it to whatever is needed. Forbid the Bottom level door. Build the grate.
- Build the screw pump, pumping toward the grate and away from the signal line direction.
- Designate a pond at the grate tile, filling the bottom layer full (all four tiles to 7/7 water).
- Hook the pump up to the signal mechanism. Test with whatever logic is needed if desired. The sensor is finished.
Bill of Materials
(Excluding the signal source and pressure plate linkage) 2 Doors 1 Mechanism 1 Corckscrew 1 Pipe Section 1 Block 1 Grate
Inverter
An inverter can be built with identical properties and build sequence by simply changing the pressure plate to trigger on 4-7 water.
Hybrid
Technically, this gate is designed for use solely in a hybrid environment, as the end result of a mechanical logic gear chain. If intended to be used completely as Fluid logic, the source would be converted to a power input, moved to the side of the pump instead of over the source tile, a hatch would be placed over the source tile, defaulting to closed when off.
Notes
A Rotation sensor can also be considered a simple Buffer. Buffers in actual electronics circuits are often used to increase the number of gates an output signal can be connected to, often by much more than the standard gate output can do. Thus, I consider mechanical logic and fluid logic to be two different types of gates, and you use the gate that is best suited for the specific job. Since fluid logic has a greater fan-out than mechanical logic, the fluid buffer can reset the power needed, since fundamentally, multiple mechanical gates can be connected together without issue until power runs out or you need to use load gear assemblies such as in an XOR or XNOR gate.
TODO
Verify that a signal gear or axle can be placed at (S) and still allow water to be pumped. If this is not possible, adjust the design to put the gear one z-level above the pump, making sure to channel the floor to allow power transfer. Construct and build a prototype and leave it run for a long time to verify the claim of no evaporation. Dwarf Science!
Pros/Cons
The pressure plate requires 100 steps to switch off, but switches on immediately. The sensor is water tight and should not evaporate under normal operation, allowing it to be disconnected from an infinite water source.
How It Works
When the source gear or axle is disabled, so will the pump be. In this state, the water level in the bottom reservoir will be a constant 7/7, thus disabling the pressure plate (set to 0-3). When the pump turns on, however, it pumps from the pressure plate tile constantly. Thus will shift the water in that tile to the rear reservoir in the top level, keeping the plate clear of water, thus triggering the plate. Since no tile of water will ever be less than 2/7 water at any time, no evaporation is possible (theoretically).
FL RAM
Random Access Memory, basic cell structure:
PXXX XXX H%>#D . .. XXX XXX XXXXXX XXXXXX Do<%HD . XXXXXX XXXXXX XXX XXX MX D X XXX XXX
Each door (D) is a simple access door for internal maintenance. Under normal circumstances, they should be forbidden entirely. The grate (#) is there for completeness and safety when priming the cell with water. If desired it could be omitted. The pumps (%> and <%, pointing the direction of pumping, specifically, the % tile is walkable) are simple constructions, no special qualities. Make them of whatever material is available. The top level hatch (H) is the RESET signal (R). The pressure plate (o) is set to detect only 7-7 water. The middle level hatch is the SET signal (S). The walls (X) can be carved from rock or constructed as needed. Power (P) is supplied through axles or gears. The cell draws 21 units of power when connected with an axle, 25 when using a gear. The output gear of the memory (M) can technically be placed wherever you need it to be.
Building
- The first step is to construct the walls and floor, or carve the same. If constructing, you should NOT build floors in the empty spaces (. on the right floor plan layout). If digging from solid rock, channel open space at those places instead. If constructing, you can build a wall instead of a door on the bottom layer.
- Build all doors, forbidding the bottom most door, the top level hatch and grate and the pressure plate. Build the screw pump on the middle z-level.
- Build the screw pump on the top z-level only after the first pump. Meanwhile, fill the bottom most tile with water by designating a pond on the location the hatch goes in the middle layer. Fill the bottom tile to 7 water, then remove the pond designation.
- Build the hatch on the middle layer.
- Link the pressure plate to the output gear (M). Link the SET and RESET hatches, remembering that the SET hatch turns the memory on, and the CLEAR hatch turns it off. Forbid the doors on the middle layer.
- Fill the middle layer with water from the grate tile on the top layer, until the open spot of the pump and the SET hatch are both covered in 7 water, then remove the pond designation.
- Forbid the door on the top layer, Connect to a power source that provides at least 20 + your connector, then stick a fork in it. It's done.
Bill of Materials
(Excluding power source gear or axle and hatch source links) 3-4 Doors 2 Hatch Covers 2 Corkscrews 2 Pipe Sections 2 Blocks 1 Grate 4 Mechanisms
Maintenance
You can adjust the connections of the hatches as well as the pressure plate as needed. Constructing some extra levers, even if on demand, will allow you to easily adjust things. If you build a water drainage system, you won't even have to worry about the excess water in the system when you open the hatch side of the middle layer. Just remember to refill the cell if you had to go in there.
Notes
This cell does not have any "circuitry" to disable or enable the output of the cell based on addressing concerns, so if you add this to an addressable memory system, that gearing will be needed. It should be, simply, an addition of another gear before a rotation sensor.
Pros/Cons
The most important benefit of this design is the complete lack of evaporation, negating the need for an infinite water supply under routine operation. The water in this cell will never be at less than 3/7 if properly constructed. Not needing an infinite water supply means you can move this to a safely walled off portion of the map, preventing all building destroyers from infiltrating through it. It is also somewhat more compact within a z-level than other designs. Finally, the cell is, fundamentally, only two tiles wide, not considering power hookup. The walls can be shared with adjacent memory cells or other constructions. The drawbacks are twofold: it requires more power to operate, and it requires three z-levels.
How It Works
At its starting state, the pressure plate tile has no water, and thus the output of the cell is off, or 0. Both hatches are initially closed. When the SET hatch gets its signal, it opens up and the constantly running pump pulls water from the main reservoir and puts it into the pressure plate cell. The plate triggers and the memory cell is effectively on, or 1. The SET signal can (and should) clear at this time, closing the hatch. The rear reservoir now contains 7/7 at the lowest tile, and 3/7 and 4/7 fluctuating in the second layer, over the hatch and the walkable portion of the pump. The water in the cell reservoir cannot drain, and will not be pumped out. Until, of course, the CLEAR hatch gets a signal. At this point the top pump will be able to pull the water out of the cell reservoir (If it was there when the signal was sent), returning the cell to its original state. The only state that has not been considered is when both hatches are open at once. When this occurs, the output of the pressure plate will be unknown at any given point. Water will be cycling constantly through the cell, and the cell will be, for all purposes, unusable. Obviously, this is a condition we want to avoid.
Electrical Similarities
This memory cell design is almost identical to a standard RS Flip-Flop circuit. The exceptions are that it only provides one output, and the SET and RESET signals are default HIGH (on) in the electrical version. The implementation is also somewhat different as well, but that is not particularly important.
FL RAM Byte (Including Power Supply)
An extension of the above, with an expanded Dwarven Water Reactor to provide power.
XDXDXDXDXDXDXDXDX X#X#X#X#X#X#X#X#X X^X^X^X^X^X^X^X^X * %-%-%-%-%-%-%-%--* H H H H H H H H
XDXDXDXDXDXDXDXDXXXXXXX XHXHXHXHXHXHXHXHXW W WX X%X%X%X%X%X%X%X%XW^W^WX XvXvXvXvXvXvXvXvXW%W%W XoXoXoXoXoXoXoXoX # # XDXDXDXDXDXDXDXDX
XDXDXDXDXDXDXDXDXXXXXXX X X X X X X X X X X X X XXXXXXXXXXXXXXXXX X X X M M M M M M M MX X X X XX X XX XXXXX
Notes
The Water Reactor used here will provide exactly 250 excess power. The memory cells themselves will cost 160, leaving 90 for the power train. The power train consists of two gears and 9 axle tiles, for 19 power, leaving 71 surplus power. The output gears are not considered part of the power train, as they will typically be used in other logic circuits, and will likely need more than 71 power to run whatever they are intended for. This leaves that power for other applications as needed.
Custom Mechanical Gates
In light of the fact that Gears are toggled, not set or unset, I am looking into the concept of more efficient designs for certain mechanical gates. The hope is that the excessive load gear trains for certain gates can be eliminated, providing upper boundaries on power usage, and making power source designs less complicated. For completeness I will also show the designs for unaffected gates. In the diagrams for Mechanical Logic gates, power sources and outputs may be gears, axles, or direct connections to a pump in the case of outputs. Sometimes it will be necessary for the power to be an extra gear. Power train and output train design are secondary and much simpler concerns. In the diagrams, capital letters indicate a normally constructed gear assembly, while miniscule letters indicate a gear assembly that is toggled once after construction with a lever.
WARNING!!!
I have NOT' yet tested these gates. The gates that require pre-toggled gears are theoretical at this point, though I intend to test them in the next day or so.
ML Buffer
Essentially this is an identity gate. It is the simplest ML gate possible, using at least one gear assembly to transfer power. It is, essentially, the reverse of the rotation sensor, taking a linked signal and converting it to P - 5 power.
PIO
Power is supplied (P), and if the input gear is functional (I), then the power, less 5 for the input gear, will be transferred to the output (O). Construction is simple, make the gear assembly and link to the signal.
ML Inverter (NOT)
This is similar to an identity gate. It is even constructed in a similar fashion, though you must also add a lever and pre-toggle the Input gear.
PiO
In all ML schematics, a lower case gear spot will indicate that it is pre toggled via a lever. Here, Power is supplied (P), and if the input gear is functional (i), then the power, less 5 for the input gear, is transferred to the output (O). Construction is simple, make the gear assembly and a lever. Link the gear assembly to the input signal, the lever to the gear, then flip the lever once. Optionally destroy the lever to recover two mechanisms.
ML AND Gate
Much like an ML Buffer gate. Two gears instead of one, and both must be active to function.
PABO
Power is supplied (P), and if both input gears are functional (A & B), then the power, less 10 for the gears, will be transferred to the output (O). Construction is simple, make the gear assemblies and link them to their respective signals.
ML OR Gate
Slightly more complex than the preceding ML gates, but still relatively easy. Again, there are two inputs. However, only one needs to be active for the result to be true.
PA BO
Essentially, this is two separate identity paths from power to output. As long as the power is available, either one can provide the needed power to output. Power is supplied (P), and if either input gears are functional (A & B), then the power, less up to 10 for the gears, will be transferred to the output (O). Construction is simple, make the gear assemblies and link them to their respective inputs. Of particular importance is the fact that this gate can potentially be constructed one tile wide and two z-levels high, if the top layer is channeled out and the bottom layer is built first for safety reasons.
ML NOR Gate
Taking advantage of the ability to pre-toggle gears, a simple NOR gate can be constructed with almost no difficulty.
PabO
Power is supplied (P), and if both input gears are functional (a & b), then the power, less 10 for the gears, will be transferred to the output (O). Construction is mild, make the gear assemblies, construct two levers, link the levers to the gears, flip both levers, optionally dismantle the levers to recover mechanisms, then link the inputs to their sources. It works as a NOR gate because we invert the inputs.
ML NAND Gate
Again, taking advantage of the ability to pre-toggle gears, we can build a NAND gate without the need for a load gear train to overload power.
Pa bO
Power is supplied (P), and if both input gears are functional (a & b), then the power, less up to 10 for the gears, will be transferred to the output (O). Construction is mild, following the same build order as for a NOR gate, though the layout is different. As with the NOR gate, it works because of the pre-toggled gears. Of particular importance is the fact that this gate can potentially be constructed one tile wide and two z-levels high, if the top layer is channeled out and the bottom layer is built first for safety reasons.
ML XOR Gate
XOR, or Exclusive OR, is much like an OR gate, except that it only activates when only one input is active.
P-A | b BaO
This operates on the principle that XOR = (A AND NOT B) OR (B AND NOT A). Because we can pre-toggle gears, we can input an implied NOT operation. The resulting AND and OR ops are simple copies from above. This gate requires a bit more space, but not nearly as much as would be needed if a drain load were used. If one is willing to have the design require more power and two z-levels, it can be built with two pathways on top of each other, taking advantage of the fact that power doesn't transfer from floor to floor without channeling.
From the side:
*Ab* PaBO
Channels would only be present between the Power (P) and Output(O) tiles, and the tiles above them (or below if you swap layers). The inputs (A, B, a, & b) provide pathways from the power to the output. Depending on where the power source is, the power drain at any state will be in the range of 10 to 20 units of power. If the power source is designed to not be on the same z-level of the output, the power drain will always be 15 when the XOR function evals to true.