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.

Difference between revisions of "User:Immibis/RAM"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
Line 74: Line 74:
 
  xxxxxx
 
  xxxxxx
 
Continue this pattern for more rows. Vertical lines of # marks are all related to the same bit of the input (it doesn't matter which line connects with which bit). Blue # marks are [[floodgate]]s or [[door]]s linked to that bit. Red # marks are floodgates or doors linked to the inverse of that bit (they will be open when the red ones are shut and vice-versa). "." is a channel to a drain, probably down a few z-levels.
 
Continue this pattern for more rows. Vertical lines of # marks are all related to the same bit of the input (it doesn't matter which line connects with which bit). Blue # marks are [[floodgate]]s or [[door]]s linked to that bit. Red # marks are floodgates or doors linked to the inverse of that bit (they will be open when the red ones are shut and vice-versa). "." is a channel to a drain, probably down a few z-levels.
 +
 +
===Per-column machinery===

Revision as of 06:53, 12 February 2010

Please note that the content of this page is (currently) only an idea and has not been tested.

Space-efficient Random Access Memory

The basic idea is to have a grid of 1x1 cells that can hold some water (or magma). The specific cell to read/write would be selected by selecting the row and the column of the desired cell. This will require some complicated machinery to manage, however.

The overall layout is like this:

Z -1
x x x x    x = wall
x x x x    H = hatch
x x x x    All the hatches in a single (horizontal) row are connected to one pressure plate
x x x x
x x x x
x x x x
x x x x
Z 0       Z +1
xxxxxxx   xxxxxxx
xHxHxHx   x x x x
xxxxxxx   xxxxxxx
xHxHxHx   x x x x
xxxxxxx   xxxxxxx
xHxHxHx   x x x x
xxxxxxx   xxxxxxx

continued for a while in each direction.

The number of rows should be a power of two, the number of columns doesn't have to be.

The values would be stored in the cells on Z+1.

Notes:

  • The "desired column" means the column containing the cell to be read/written.
  • The "desired row" means the row containing the cell to be read/written.
  • "Flood XXX to ZZ" means to flood the area up to and including the Z-level ZZ.
  • "Drain XXX" means the area should not be flooded at all.

To read a cell:

  1. Flood all columns except the desired column to Z0. Flood the desired column to Z-1.
  2. Open the hatches in the desired row.
  3. If the cell contains water, the water will flow onto a pressure plate on Z0 of the column (not shown in the diagram)

This is a destructive read, so the data must be rewritten afterwards.

To write a 1 to a cell:

  1. Flood all columns except the desired column to Z0. Flood the desired column to Z1.
  2. Open the hatches in the desired row.
  3. Water will flow into the cell, if it isn't already there.

To write a 0 to a cell:

  1. Flood all columns except the desired column to Z0. Drain the desired column.
  2. Open the hatches in the desired row.
  3. Water will flow out of the cell, if it's there.

Memory controller

Just another reminder: this is all theory and hasn't been tested.

The controller described here requires a source of highly pressurized water. (From a pump or an infinite source, which should be a few z-levels higher than the machinery). Remember to be very careful!

Per-row machinery

Each row needs a single pressure plate connected to all hatches along that row. The input to this part of the controller is a binary number indicating which row to select. Since the number of rows must be a power of two, this is easy:

xxxxxx
x.^# xxx
xxxx # x
x.^# x xxx
xxxxxx # x
x.^# x x x
xxxx # x x
x.^# xxx x
xxxxxx x  <-- pressurized water source
x.^# xxx x
xxxx # x x
x.^# x x x
xxxxxx # x
x.^# x xxx
xxxx # x
x.^# xxx
xxxxxx

Continue this pattern for more rows. Vertical lines of # marks are all related to the same bit of the input (it doesn't matter which line connects with which bit). Blue # marks are floodgates or doors linked to that bit. Red # marks are floodgates or doors linked to the inverse of that bit (they will be open when the red ones are shut and vice-versa). "." is a channel to a drain, probably down a few z-levels.

Per-column machinery