Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

What are the things that I should be familiar with to make my own computer that can add two numbers, in the same way that happens in a calculator? Can anyone please give me links that teach these things in detail? I know how to program but have never programmed at the root level.

share|improve this question

closed as off topic by Jonathan Khoo, Walter, Anna Lear Aug 25 '11 at 12:34

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

If you want to physically build a computer from scratch, I think CODE from Charles Petzold is a worthy read. –  Péter Török Aug 25 '11 at 10:44
This should be on electronics.stackexchange.com and someone should explain to him how an adder works and is built. That'd be a simple physical computer. –  Falcon Aug 25 '11 at 10:47
@steve: What do you want? Do you want to build a computer that can add two numbers or do you want to write a software which adds two numbers? –  Falcon Aug 25 '11 at 10:57
@steve: Well then find your way to electronics.stackexchange.com –  Falcon Aug 25 '11 at 11:05
I think that as this stands it's too broad a question. Head over to electronics as has already been suggested and see if any of the existing questions can help. If not post again, but you might need to have tried something first. –  ChrisF Aug 25 '11 at 11:18

3 Answers 3

If you really wish to do this via hardware, I would suggest going out and buying Code by Charles Petzold. The book starts of with a nice explanation of what binary is and how it ties into... well everything and then jumps right into the hardware aspects. If I recall correctly, he even provides the part numbers for what you need (but I do not have my copy of my book with me at the moment so can't say this for sure).

share|improve this answer

There are a load of good articles on howstuffworks.com

Adders are here. But you probably want to start with Electronic Gates, if you don't know it already.

Prepare to follow a lot of links to a lot of text, but it's well-written so will be fun if you are interested (which I assume you are, if you're asking).

share|improve this answer

The "real" answer would be to get a book like Computer Architecture: A Quantitative Approach, read up on binary arithmetic, adders (half, full, ripple carry, etc), understand quite a bit of detail, and then implement everything. That seems like overkill because you don't really want to design a full fledged computer - you want to make a limited system that can mainly add two numbers.

So instead, why not implement a computer in a programming language? In intro CS, I had the chance to implement a TC-201 machine using Scheme.

Each instruction for the TC-201 is represented by a pattern of 16 bits. The leftmost 4 bits of the instruction are the opcode, which specifies which operation is to be done. With 4 bits, there are 16 possible different opcodes, with integer values of 0 through 15.

The remaining 12 bits of an instruction are the address, which is used to specify the memory location to be used in the operation. This is a single-address format for instructions. If two values are required (for example, for ADD), the other value is in another 16-bit register called the accumulator, abbreviated ACC. We now describe the effects of each type of instruction.

Check out this PDF for more information. This will allow you to put in two variables, issue an ADD instruction, SUB, etc. It's not the same as building a real computer from scratch, but it'll help you understand assembly language (to an extent), and you can implement your own adders, and learn most of the stuff that you'd learn from making your own (aside from the hardware aspects).

share|improve this answer
Related to using Scheme, I've seen Lennart Augustsson demo a pong game, compiled from Haskell(-ish) directly to an FPGA. (Yes, he's a cool hacker.) –  Macke Aug 25 '11 at 11:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.