Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 4 5 [6] 7 8 ... 11

Author Topic: Dwarven Computer  (Read 83621 times)

NRN_R_Sumo1

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #75 on: March 13, 2010, 02:29:27 pm »

Took me a minute to realize those were pumps, totally thought those were cows.
Logged
A dwarf is nothing but an alcohol powered beard.

Innominate

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #76 on: March 13, 2010, 11:13:44 pm »

Took me a minute to realize those were pumps, totally thought those were cows.
I had the same thought. You could probably figure out some system to use creature logic instead of fluid logic, but it would almost certainly be less compact.

Then again, a cowputer is almost worth it.
Logged

Jong

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #77 on: March 18, 2010, 11:36:25 am »

Somewhere in a parallel universe...
***

Spoiler (click to show/hide)

Computer: HA. HA. HA. DIE. INSECTS.

Ustuth: Damn the doors are locked. Quick Zon! Pry open the doors with your fingernails!

Zon: It's no good! I just clipped them yesterday!

Ustuth: But the new version isn't out yet!

***

Okay, so I tried to murder all my dwarves. Nobody's perfect  ::)  Funny way to celebrate the completion of my computer though...

Jong enjoyed toppling something over recently.

This was the first time I deliberately attempted to harm my dwarves, so it didn't turn out so well. Turns out that the computer is too big to flood quickly :P  It was starting to look like the dwarves would starve before they drowned. Then I told them to hide out in the cistern because it would be "safer". I locked the doors and opened the other door.

Well, it turned out pretty safe after all. They all fell into the pit used by the pump, but the pump was still active! It left this little dry spot under the pump :(

After that I gave up on killing my dwarves and returned to my original universe  ;D

I only managed to kill 9 dwarves. Only the marksdwarf drowned, when he got sucked into an output buffer. 1 child fell down the cave river pit and landed in the power plant. The rest fell down the service stairs as I was moving them into the the cistern.

I was really disappointed when the dwarves reacted rather nonchalantly to their imminent demise. They all just continued gathering around the breach. I was hoping they would run around screaming, but I guess I need a lot more water for that.

Or magma.

I had noticed that the last carry bit wasn't being used in the adder. It was sort of an overflow bit. I thought I could rig up a single use pressure plate to it to punish anyone who tried to overflow the computer. hehe

Technogibberish
Spoiler (click to show/hide)

Ok back on topic! As I said earlier, I have completed my computer and it was a

[size=8]COMPLETE SUCCESS!!![/size][/color]

....

Ok you might want to first take a leisurely look at the completed completed computer here.

For my testing run, I prepared a simple program that would test all all the various functions of the computer. These are load from and store to memory, add, subtract, bitshifting left and right, a conditional jump when the accumulator is not negative, and halt. I couldn't test the halting function as the clock was manually operated.

I loaded the following into the memory

data cells
32-00001001
31-10100001
30-00001101
29-00000011

Program cells
1-10111111-binary shift left cell 32 (00010010)
2-11011110-binary shift right cell 31 (11010000)
3-00011101-load cell 30 (00001101)
4-01011111-add 1101 and 1001 (00010110)
5-01111100-subtract 11 from 10110 (00010011)
6-00111011-store 10011 in cell 28
7-10000000-PC to 00000

Well actually the cell numbers start from 0 and end at 31, but that would just confuse everyone. The number in the bracket is what you would expect to see in the accumulator at the execute phase of the fetch cycle.

Ok... I'll be posting up screenshots of all the phases of the first fetch cycle, and then only the results for the remaining executions.

Memory banks before the test
Spoiler (click to show/hide)

A dwarf demonstrating the operation of the clock.
Spoiler (click to show/hide)

I was testing the clock when I discovered that pumps don't immediately switch off when the power is cut. The first time I tried it, the water cell jumped 6 pumps. After that, the clock was manually operated. I also realized that I needed to connect the decoders to the memory storage cells instead of their output cells, because a 0 to a decoder is also an operation, so it needed to be kept primed.

Phase 1-1
Transfer accumulator to AR1.
Spoiler (click to show/hide)

Since the accumulator is empty, nothing happens!

Phase 1-2
Transfer PC to MAR, increment PC+1
Spoiler (click to show/hide)

PC is empty, so MAR is also empty. Notice the PC+1 now has a 1 in it!

Phase 1-3
Load Instruction register from memory, transfer PC+1 to PC.
Spoiler (click to show/hide)

Load whatever is in address 00000000. Which is 10111111. Great!

Not so great. The first time I did this, I discovered a horrible backward power flow problem in the multiplexer. It caused all the bytes in the memory that shared a bit with the currently selected byte to become active as well, leading to disaster. Fixing it took over 1000 mechanisms.

Phase 1-4
Transfer PC+1 to PC
Spoiler (click to show/hide)

Ok, now PC has been incremented.

Phase 1-5
Write MAR from IR
Spoiler (click to show/hide)

Ok the instruction says the data is at cell 32 (or 31) so 11111!

Phase 1-6
Execute Bitshift left on memory cell 11111(00001001)
Spoiler (click to show/hide)

Huzzah! 00010010! Totally expected result!

Ok. Now I will show you the results from the remaining executions:

Phase 2
Execute Bitshift Right on memory cell 11110(10100001)
Spoiler (click to show/hide)

Result? 11010000! The leftmost 1 was retained and the rightmost 1 was dumped!

The first time I did this, I experience the same horrid backward power flow enabling the bitshift left circuit and half of the adder! I had to install triggered gears along the power supply rows in order to break the power transmission.

Phase 3
Execute load cell 30 (00001101)
Spoiler (click to show/hide)

Hurrah! The accumulator has been loaded from memory!

Phase 4
Execute Add 1101(accumulator) and 1001(contents of cell 11111)
Spoiler (click to show/hide)

Yay! The adder still works even after I messed with it!

Phase 5
Execute Subtract 11(contents of cell 11100)  from 10110 (accumulator)
Spoiler (click to show/hide)

This one was interesting. I noted that the accumulator was filled completely, then settled into the correct answer. This was because the inputs were inverted before the signals from the memory output multiplexer came in. This is evidence that pumps do not operate instantly.

Phase 6
Execute Store 10011 into cell 28(or 27)
Spoiler (click to show/hide)

Hoorah! The memory write mechanism works! It was a massive grindfest. The WHOLE BLEEDING EXERCISE was a massive grindfest!

Phase 7
Execute Jump to 00000 if accumulator is not negative.
Spoiler (click to show/hide)

The program counter is cleared and program will start looping if it were allowed to continue.

Final Analysis

Computer Performance: The computer was incredibly slow. Part of it had to do with the manual operation of the pumps, which needs to be ordered while paused. Still, the testing run took the better part of a in-game month to complete, that is, after the gremlins were ironed out. The biggest source of operational lag is mist generated by falling water. Of course, the gigantic contraption itself generates tons of lag.

Reliability: The computer was fairly reliable, producing the correct results given enough time. However there is a problem with the free draining output buffers. They appear to consume unusually large quantities of water which simply vanish. The losses are much bigger than anticipated evaporation losses. Its possible that the evacuated area under the operation pumps creates a larger pan for the water to evaporate. The water losses tend to cause some glitches, especially for the units at the edge of the shared pool, if allowed to run for too long.

Practicality: Monstrous. Monstrously impractical. The final parts count topped 8500 mechanisms, (excluding those in my other contraptions), 2000 logs (including power supply), 672 pumps, and 1000s of other bits like doors and blocks for the floor of the channels. That's just the materials. I don't think I can adequately describe how grinding linking the 1000s of gears was. I think I'm starting to count in powers of 2. Its absolute insanity. You should be glad the computer doesn't spikes of human bone, or has an image of 0s and 1s in human leather on it.

Conclusion: You can build a programmable digital computer in Dwarf Fortress. Its possible, it can be done. People have done things in Dwarf Fortress for less reason. I really wouldn't recommend it though, unless you happen to be suffering from the same kind of mental illness as me. If you just want to play with dwarven computing, I offer up my save file to the public. Feel free to try out any sort of program you like. I made sure to write enable all the memory cells, even though I didn't have to.

P.S. Also feel free to take advantage of the tower I built. I haven't tried dropping a goblin 140 z-levels yet.  :P

JimiD

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #78 on: March 18, 2010, 11:59:01 am »

Congratulations!

I was hoping you would deliver on this, and you have, in spades.

I suspect you have to programme silicon computers to appreciate this properly, which I dont, but even so.  Greatly impressed.

This will go down in legend.
Logged

Scruga

  • Bay Watcher
  • Urist McDwarf cancels eat: Interupted by goat
    • View Profile
Re: Dwarven Computer
« Reply #79 on: March 18, 2010, 12:09:02 pm »

Someone actually won DF! Congratulations you're my hero! :D
Logged
New question! If I were to remove elves [INTELLIGENT] tag in the raws, would it work?
Dwarf Fortress: Where taking a creatures intelligence is an accepted way of modding.

Sphalerite

  • Bay Watcher
    • View Profile
    • Drew's Robots and stuff
Re: Dwarven Computer
« Reply #80 on: March 18, 2010, 12:58:01 pm »

just ... wow.

Now I feel compelled to make one.
Logged
Any intelligent fool can make things bigger and more complex... It takes a touch of genius --- and a lot of courage to move in the opposite direction.

kg333

  • Bay Watcher
  • Derp.
    • View Profile
    • Steam Profile
Re: Dwarven Computer
« Reply #81 on: March 18, 2010, 06:29:25 pm »

Bravo, sir, bravo!  Like someone said earlier in the thread, get this man a custom forum title, "Inventor of the Dwarven Computer!"

KG
Logged

darkrider2

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #82 on: March 18, 2010, 07:47:23 pm »

Yeah you need a custom forum title this is one of the most amazing things I've ever seen. Possibly even topping undergrotto.
Logged

Jong

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #83 on: March 18, 2010, 09:28:38 pm »

Hmm is that even possible? I've only seen "Bay Watcher" and "Escaped Lunatic".

Naresomez

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #84 on: March 19, 2010, 12:00:06 am »

Hmm is that even possible? I've only seen "Bay Watcher" and "Escaped Lunatic".

If the mods wish it, so it shall be.
Logged
Recaptcha Pictionary!
http://www.bay12games.com/forum/index.php?topic=51755.0

"And on the 5th frame, He bowleth a strike, and there was much rejoicing to be had."

Leotto

  • Bay Watcher
  • Escaped Lunatic
    • View Profile
Re: Dwarven Computer
« Reply #85 on: March 19, 2010, 01:14:20 am »

See now, the story of the original computer "bug" was a moth in the computer. So does that mean if you find an elf in your dwarf computer, does that make your problem an "elf"?

Apparently it's "evaporation".
Logged
▬(͜Ob͌viously.▬

Jong

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #86 on: March 19, 2010, 06:28:09 am »

LOL I just discovered my government symbol is 2 circles and is called "The Geared Labors".

I think I shall erect a monument somewhere in my fort.

EDIT: I'm thinking something along the lines of a gear assembly in a circle. Kind of like the symbol of the Galactic Empire...
« Last Edit: March 19, 2010, 07:00:50 am by Jong »
Logged

Shinziril

  • Bay Watcher
  • !!SCIENCE!!
    • View Profile
Re: Dwarven Computer
« Reply #87 on: March 21, 2010, 12:32:42 pm »

Can we get some "logical blueprints" for some of the trickier bits (like how many buffer registers you needed, and how they're hooked up together)?  I want to try my hand at this.
Logged
Quote from: lolghurt
Quote from: Urist McTaverish
why is Dwarven science always on fire?
Because normal science is boring

Jong

  • Bay Watcher
    • View Profile
Re: Dwarven Computer
« Reply #88 on: March 22, 2010, 08:32:30 am »

Can we get some "logical blueprints" for some of the trickier bits (like how many buffer registers you needed, and how they're hooked up together)?  I want to try my hand at this.

I'm not sure exactly what you need but does this help?



This diagram (which is in the first post) illustrates how the various registers are hooked together. The pressure plates of the output buffer of the register at the base of the arrow is linked to the input gears of the memory cells of the register at the point of the arrow. (I hope this sentence doesn't cause even more confusion)

The internal structure of each register, represented as boxes in the diagram, is mostly the same. The pressure plates of the memory cells are linked to the input gears of the output buffers, except in the case where the register is supposed to activate a decoder, where those same plates are directly linked to the gears of the decoder.

This diagram is only supposed to illustrate the data flows in the computer. I should clarify that the arrow between the memory address register (MAR) and the memory shouldn't really be there, since the MAR only sends the data to the 5-32 decoder. You should also be aware that the MAR, PC and PC+1 are only 5 bits long, so they only need to be hooked to the appropriate 5 bits in an 8 bit register.

The other bit of info you need for a full set of "logical blueprints" are the link tables of the clock and the control unit. These are slightly updated versions of the ones in the first post that I copied from my design manuscript on google docs.

Oscillator Link table

O1 Read accumulator, write AR2, write IR, write MAR
O2 Read PC, write MAR, activate ALU (adder select, C0=1), write PC+1
O3 Read MEM, read MAR. activate decoder, write IR
O4 Read PC+1, write PC, write MAR
O5 Read IR, write MAR, write PC+1
O6 Execution (read IR, turn on control unit)

Control unit link table

O0. Read memory, read MAR, activate decoder, write accumulator, select transfer
O1. Read accumulator, write memory, read MAR, activate decoder
O2. Read memory, read MAR, activate decoder, read AR2, Send Add signal to ALU (adder select), write accumulator
O3. Read memory, read MAR, activate decoder, read AR2, Send Subtract signal to ALU (adder select, C0=1, invert input A), write accumulator
O4. Read IR, write PC if ACC7=0
O5. Read memory, read MAR, activate decoder, Send Shift left signal to ALU (SHL select), write accumulator
O6. Read memory, read MAR, activate decoder, Send Shift right signal to ALU (SHR select), write accumulator
O7. Cut power to oscillator.

Well its also slightly out of date after modifications I made during testing. Its not necessary to read the memory to use the decoders they are linked to, since the decoders are linked directly to the memory cells of their registers. You could probably dispense with the output buffer of the MAR and the first (or last, depending on how you look at it) 3 digits of the the IR, which operates the control unit decoder.

Of course, if your computer is different, then you should draw up your own link tables and data transfer diagrams. It should be sufficient to guide you when you are doing the linking phase of construction.

I recommend looking at a few sites if you're interested to learn more about designing your own computer.

This one belongs to some guy who apparently built a computer out of various prefabricated integrated circuits. While the details of electronic circuitry are somewhat irrelevant to dwarven computer construction, I thought his design considerations and description on how his computer was supposed to work was really useful when I was researching this project.
http://cpuville.com/

This other document I found was incredibly useful and I really based a lot of my computer on it. It states really concisely exactly what I need to build a minimal computer, what components are necessary and how to organize them, what functions I needed, how a fetch-execute cycle looks like. 
http://csclab.murraystate.edu/bob.pilgrim/405/DigLogic_Apx_A_The_Very_Simple_Computer.pdf

Well I hope that helps you out. Unless you meant something else?

Shinziril

  • Bay Watcher
  • !!SCIENCE!!
    • View Profile
Re: Dwarven Computer
« Reply #89 on: March 22, 2010, 09:49:44 am »

Those website links are just perfect, thanks.

Shinziril withdraws from society . . .
Logged
Quote from: lolghurt
Quote from: Urist McTaverish
why is Dwarven science always on fire?
Because normal science is boring
Pages: 1 ... 4 5 [6] 7 8 ... 11