After finding out that a cart approaching a ramped pit across a hatch cover can sometimes behave differently from one passing a bridge or open floor (
http://www.bay12forums.com/smf/index.php?topic=15096.msg4702521#msg4702521), i experimented with this approach some more and fiddled with input speeds, so now i can present a bunch of new designs for the seven major logic gates.
Identity/NOT:
There are ramped pits under the bridge and both hatches. The cart enters from the east.
Not visible tracks are: EW (ramp) under the bridge, NSW (ramp) under the northern hatch, NE (ramp) under the southern ramp, NE under the door. All visible buildings are switchable by input. There are several NOT operation logics possible.
Example operation order for identity/NOT:
always open (no switching during operation): door, bridge and southern hatch
switched by input: northern hatch
input true - output straight west (identity)
input false - output to the east from southern pit (NOT)
AND/NAND gate:
There are pits under the bridge and both hatches... i already said that, right? Yes, it's the exact same architecture as above, the only difference is the switch logic.
always open (no switching): bridge, southern hatch
switched by input: door, northern hatch
in case of AND - output straight west
in case of NAND - output east from the southern hatch/pit
OR/NOR gate:
Yep, the same one again, with different switch logic once more.
Always open (no switching): bridge, northern hatch
switched by input: door, southern hatch.
in case of NOR: output through northern hatch
in case of OR: output either straight west, or east from southern pit, can be collected by a single pressure plate directly northeast of the bridge
XOR/XNOR gate:
This was the one that took the fiddling around. That's why the bridge is required. It also only works with a dwarven push or similarly low speed.
always open (no switching): door, southern hatch
switched by input: bridge, northern hatch
both inputs equal: output straight west
inputs different: output east from southern pit
So this is a single circuit using three ramps and a footprint of 4x5 tiles on the upper level (not counting whatever sends the cart into the circuit) which is configurable into each of the basic logic gates. In three presented cases, the "true" output is the western branch and the equivalent "not" output the south-east one. The outlier here is the OR gate, which generally has two possible "true" outputs.