v50 Steam/Premium information for editors
  • 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.
This notice may be cached—the current version can be found here.

40d:Mechanical logic

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Article Note: This is a file dump from a TI-89 Calculator that has been converted to Wiki format.

Mechanical Logic

Mechanical Logic is a faster, more reliable replacement for Water Logic. It is also somewhat more complex, requiring massive amounts of wood, stone, and mechanical power.

The following examples operate on these design rules

  • Systems use Binary Logic
  • Logic High is defined as an Unpowered axle.
  • Logic Low is defined as a Powered Axle.
  • Gearboxes, when supplied a Trigger High, thusly begin to transmit a Logic High signal

Note that there are several flaws with Mechanical Logic. As noted, large amounts of wood, stone, and massive amounts of power are required. Secondly, the system operates on the concept of the 'rotation sensor' Obviously, this does not exist in Dwarf Fortress at this time, and there are no plans for such a device to exist- therefore, a surrogate unit is required.

Now, there is one device we can use- a pressure pad. Therefore, we simply need to convert mechanical energy into pressure- for example, using a Screw Pump.

XXXXXXX
X.%>^.X
XXXX^XX
   XXX

The pump draws from a constantly-filled tile on the left, and pushes left. The pressure pad there then acts as the 'sensor' for whether there is rotation present. Finally, the pit on the right acts as a drain- when the pump stops, the water drains out and the pad resets (no rotation). The lower pad shown is used as an 'inverse' out.

Note that in all the examples, "M" is used to denote a rotation sensor- just affix a gearbox instead and route that to one of these units, "P" is used just to say where Power is supposed to be applied (though not all of these have P where it should be), and "X", "Y", and "Z" are just to show that in a multi-part logic gate, which 'sensor' links to which gearbox internally. "o" is a gearbox that does not have any trigger connections, and is used for visual clarity.

Unclocked Logic

(N)OR Gate

→**→M O
 AB

(N)AND Gate

  A
→o*o→M O
 o*o
  B

(In)equal

When Input A != Input B, O goes LOW. Invert Y and Z to change this

  A          !A
→o*o→M Z   →o*o→M Y
 o*o        o*o
  B          !B

 YZ
→**M O

AND NOT

When A is HIGH and B is LOW, O goes HIGH

  A
→o*oM O
 o*o
  !B


NOT or BUFFER

→*→M O
 A

SELECT

[A?B:C] O will be either B is A is HIGH, or C otherwise. In other words, IF-THEN-ELSE

B!A
→*
 o→M O
→*
CA

DISTRIBUTOR

Passes D to the selected output (selected via A) and a logic HIGH to the other. Remove * lines to output a logic LOW instead.

   A
*P--*!A
P*o*o---→O0
 Do--*o-→O1
*P----*A
     !A

S/R LATCH

P = Power S = Set R = Reset

   !RS
P→o*o*M O
  o*o
   O

OSCILLATOR

→*M O
 !O

(AND-NOT) OR

A & Z are actually inverted, just not shown.

AB     
**
|MZM O
o-*o
P--*C

Clocked Logic

D-LATCH

When Clk is HIGH, O will output A When Clk is LOW, O will output whatever A was when Clk went LOW

A !Clk
*-*oM O
o*-*
↑O Clk
P

Select - Hold Choice

This is basically a clocked SELECT gate- it acts like a normal Select, but only while Clk is high. Then Clk is low, it outputs whatever the last selected output was when CLK was last HIGH.

  A
P→**!Clk
  oM Z
P→**Clk
  Z 
  
 B!Z
P→*
  o→M O
P→*
 CZ

SELECT-HOLDALL

This is like the above, but it also holds the last values of B and C as well.

B !Clk
*-*oM X
o*-*
↑X Clk
P

C !Clk
*-*oM Y
o*-*
↑Y Clk
P

PA!Clk
→**
  oM Z
→**
PZClk
 
X!Z
→*
 o→M O
→*
YZ


Complex Logic Gates

MEMORY CELL

Type A

R = Read Input W = Write Input High (Off) is R/W D = Data line (I/O)

ZW
**
↑oM Z
 *!W
Do↓P

 **
!RZ

Type B

R = Read W = Write High (Off) is R/W D = Data line (I/O) A = Cell Active (Enable Chip)

Z
*oo
↑**WA
Poo
 oM Z
 *!W
 *!A
Do
 *!A
 **←P
!RZ