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.

Editing v0.34:Adder (Computing)

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.

You are editing a page for an older version of Dwarf Fortress ("Main" is the current version, not "v0.34"). Please make sure you intend to do this. If you are here by mistake, see the current page instead.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{quality|Exceptional|21:27, 2 December 2012 (UTC)}}{{Computing}}{{av}}
 
 
 
Understanding of principles of addition are important to many dwarven [[computing|logic]] devices.  Addition can be used in devices to keep track of various values, such as the number of items in a [[stockpile]], the number of [[time|years]] that have passed since a particular event, or more abstract computation.
 
Understanding of principles of addition are important to many dwarven [[computing|logic]] devices.  Addition can be used in devices to keep track of various values, such as the number of items in a [[stockpile]], the number of [[time|years]] that have passed since a particular event, or more abstract computation.
  
Line 57: Line 55:
  
 
===1 bit add===
 
===1 bit add===
In the simplest adder, we consider two values.  Because of this, we now have four possibilities: 0+0=0, 1+0=1, 0+1=0, and 1+1=10=0.  This is the same table of values we get with an XOR operation.  Therefore, the addition of two 1 bit values is an XOR on those two values.
+
In the simplest adder, we consider two values.  Because of this, we now have four possibilities: 0+0=0, 1+0=1, 0+1=0, and 1+1=10=0.  This is the same table of values we get with with an XOR operation.  Therefore, the addition of two 1 bit values is an XOR on those two values.
  
 
===2 or more bit add===
 
===2 or more bit add===
Line 83: Line 81:
  
 
==Look-ahead carry==
 
==Look-ahead carry==
While a simple adder is capable of reliable addition, it can be extremely slow.  Consider a 8-bit adder: the value of the 8th bit depends on the carry derived from the 7th bit, which in turn depends on the carry derived from the 6th bit, and so on.  The entire addition has to be carried out sequentially, rather than adding the bits in parallel.  Because of the way the carry ripples through the value, such systems are called ''ripple carry adders.'' When water or creatures are used in the circuits, this can mean a day or more to add two 8 bit values.  However, the process can be improved considerably, at the expense of greater complexity, by implementing a look-ahead system.
+
While a simple adder is capable of reliable addition, it can be extremely slow.  Consider a 8-bit adder: the value of the 8th bit depends on the carry derived from the 7th bit, which in tun depends on the carry derived from the 6th bit, and so on.  The entire addition has to be carried out sequentially, rather than adding the bits in parallel.  Because of the way the carry ripples through the value, such systems are called ''ripple carry adders.'' When water or creatures are used in the circuits, this can mean a day or more to add two 8 bit values.  However, the process can be improved considerably, at the expense of greater complexity, by implementing a look-ahead system.
  
 
Look ahead systems break the values up into sequences of bits, based on the fact that if both values of the nth bit are 0 ((NOT[n])AND(NOT[n'])), any carry will end at that bit, and that if both values are 1 ([n]AND[n']), that bit will generate a carry.  Based on this, it's possible to process, in parallel, the addition of various bit-lengths based on the knowledge that carries will not propagate past a carry-ending bit.  This can vastly improve the time necessary to add two values.
 
Look ahead systems break the values up into sequences of bits, based on the fact that if both values of the nth bit are 0 ((NOT[n])AND(NOT[n'])), any carry will end at that bit, and that if both values are 1 ([n]AND[n']), that bit will generate a carry.  Based on this, it's possible to process, in parallel, the addition of various bit-lengths based on the knowledge that carries will not propagate past a carry-ending bit.  This can vastly improve the time necessary to add two values.
  
[[User:Jong/Dwarven_Computer|Jong's dwarven computer]] uses look-aheads for faster addition, and is capable of add-with-carry. The design can be further compressed to a very compact and versatile full adder: [[User:Larix/Adder]].  For an example using creature logic, see [[User:Vasiln/Goblin_Logic_2#Look-ahead_Adder|Look-ahead Add]].
+
[[User:Jong/Dwarven_Computer|Jong's dwarven computer]] uses look-aheads for faster addition, and is capable of add-with-carry.  For an example using creature logic, see [[User:Vasiln/Goblin_Logic_2#Look-ahead_Adder|Look-ahead Add]].
  
 
==Multiplication and division==
 
==Multiplication and division==

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)