|
Home / Computers
How Computers Add - A Logical Approach
By:Tony Stockill
We looked at Number Systems and counting (see It's a Binary World - How Computers Count) last time. As a quick refresher, we saw that computers are made up of many units of 0 and 1, the binary system. 1 is the highest digit possible so numbers in the computer are stored as for example 1010 or 10 in decimal. We also saw that these binary numbers can be seen as octal (8) or hexadecimal (16) numbers - in this case 1010 becomes 15 octal, or A hex.
You probably realise that the 'standard' PC code is in 8 bit bytes taking the hex system a stage further. You may also know that processors, and Windows software that runs on them, have progressed from 8 bits to 16 bits to 32 bits to 64 bits. Basically this means the computer can work on 1,2, 4 or 8 bytes at once. Don't worry if this is all Gobbledegook, you don't need it to understand how computers add!
OK now to the Math - cringe time! It's a little more complicated than last time, but if you think logically, like a computer, realising they are really dumb, you will sail through it!
We take a break here to look at a bit of math you may not have heard of - Boolean Algebra. Once again it's really simple, but it shows you how a computer works, and why it is so pedantic!
Boolean Algebra is named after George Boole, an English Mathematician in the 19th Century. He devised the logic system used in digital computers more than a century before there was a computer to use it!
In Boolean Algebra, instead of + and - etc. we use AND and OR to form our logic steps.
For example:-
x OR y = z means if x or y is present, we get z.
However,
x AND y = z means that both x and y need to be present to get z.
We can also consider an XOR (eXclusive OR).
x XOR y=z means that x or y BUT NOT BOTH must be present to get z.
That's it! That's all the math you need to understand how a computer counts. Told you it was simple!
How do we use this logic in the computer? We make up a little electronic circuit called a Gate with transistors and things, so we can work on our binary numbers stored in a register - just a bit of memory. (And that's the last electronics you'll hear about!). We make an AND gate, an OR gate, and an XOR gate
When we add in decimal, for example 9+3 we get 2 'units' and carry one to the 10s, giving 10+2=12
Remember the binary bit values in Decimal 1,2,4,8 etc? We start at 0 then 1 in the first bit position, the 1 bit. If we add 1 + 1 binary we have to end up with 10, which has a 1 bit in the second bit position, and a 0 in the first, giving Decimal 2+0=2. This second bit position is formed by a CARRY from the first bit.
To make an adder we must duplicate with a logic circuit the way we add in binary. To add 1+1 we need 3 inputs, one for each bit, and a carry in, and 2 outputs, one for the result (1 or 0), and a carry out, (1 or 0). In this case the carry input is not used. We use 2 XOR gates, 2 AND gates and an OR gate to make up the adder for 1 bit.
Now we go another step, and forget about gates, because now we have a Logic Block, an ADDER. Our computer is designed by using various combinations of logic blocks. As well as the adder we might have a multiplier (a series of adders) and other components.
Our ADDER block takes one bit (0 or 1) from each number to be added, plus the Carry bit (0 or 1) and produces an output of 0 or 1, and a carry of 0 or 1. A table of the input A, B and Carry, and output O and Carry, looks like this:-
With no Carry in:
A B c O C
0 0 0 0 0
1 0 0 1 0
0 1 0 1 0
1 1 0 0 1
With Carry in:
A B c O C
0 0 1 1 0
1 0 1 0 1
0 1 1 0 1
1 1 1 1 1
This is known as a Truth Table, it shows output state for any given input state.
Let's add 2+3 decimal. That is 010 plus 011 binary. We will need 3 ADDER blocks for decimal bit values of 1, 2 and 4)
The first ADDER takes the Least Significant Bit (decimal bit value 1) from each number. Input A will be 0, input B will be 1 with no carry - 0.
From the truth table this gives an output of 1 and a carry of 0 (3rd row). BIT 1 RESULT = 1
At the same time the next ADDER (decimal bit value 2) has inputs of 1, 1 and a carry of 0, giving an output of 0 with a carry bit of 1 (4th row). BIT 2 RESULT = 0
The next ADDER (decimal bit value 4) has inputs of 0, 0 and a carry of 1, giving an output of 1 with no carry - 0 (5th row). BIT 4 RESULT = 1.
So we have bits 4,2,1 as 101 or 4+1=5.
It seems like a laborious way to do it, but our computer can have 64 adders or more, adding simultaneously two large numbers billions of times a second. This is where the computer scores.
Next time we will get to how a computer performs more complcated operations, and it's simple!
Digg
del.icio.us
Blink
Stumble
Spurl
Reddit
Netscape
Furl
Article Source: http://www.articles2k.com
Tony is Webmaster of and a contributer to www.what-why-wisdom.com/ . For diagrams to go with this series of articles check out "historyofthecomputer.html" on that site.
|
|
| Top Computers Articles |
- 1). The danger behind peer-to-peer file sharing By : Migz Mon
File sharing is very common nowadays. You can get a P2P (peer-to-peer) program for free, and soon start sharing stuff like music, videos and programs. We use these applications freely and most of us don’t know the risks involved when using them.
Questionable reliability of files – Once we get our hands on a P2P program, we download everything we want like crazy.
|
|
|
|
|
- 4). Is The Internet Censored? By : J Schipper
When most people think about Internet censorship, the usual suspects immediately come to mind : Communist China and repressive Islamic countries. Unfortunately, Westerners have an embarrassment all their own : Australia's net censorship law, established in 2000.
Freedom House, a non-profit U.S. organization dedicated to spreading human rights and freedom, undertakes regular surveys on press freedom and censorship.
|
- 5). Toshiba Libertto U100, smaller yet better than you might imagine! By : john
Have you ever wondered how small a laptop can be? Well, utilizing today’s technology Toshiba does a perfect job at demonstrating it; the Libertto U100 is one of the very few laptops that have such a rich feature set fitted altogether within such a small space. Of course, if you believe that a fingerprint authentication system is too much for such a.
|
- 6). Does CCTV Really Reduce Crime? By : Robert Michael
In the UK, home of twenty percent of the world's CCTV cameras, there is mounting concern about its invasion and lack of regulation. "UK Public CCTV Surveillance Regulation Campaign."
The thought-provoking questions they ask are good ones.
They want to know, for instance, why, if television programming and licensing is so heavily regulated in the UK.
|
|
|
- 8). Preparation Tips For Comptia A+ Certification By :
The Industry Standard CompTIA A Plus Certification exam has two parts; approximately 80 questions for each part.
* Core Hardware: $153 - min. passing score 515
* Operating Systems Technology: $153 - min. passing score 505
(CompTIA corporate members can take the exams for $98, employers that require this test are usually corporate members and will inform you of this.
|
- 9). Can Cell Phones Harm Your Health? By : D Ruplinger
It seems like everywhere a person goes there is at least one person in view with a cell phone to their ear whether it is on the road, in a store, in a parking lot, walking down the street, etc. Even in places where cell phone usage is banned such as concert halls or movie theaters there is the occasional offender, or more likely, at least a few people using the text messaging feature on their phone.
|
|
|
| New Computers Articles |
|
|
|
|
|
|
|
|
- 5). If You Want Flexibility And Portability Consider A Laptop By : Gregg Hall
If you are one of those who works with a computer on a daily basis like me you should consider a laptop. I have actually owned three now and I think I would be lost without mine. I still use my desktop PC quite a bit at home but the laptop comes in extremely handy when I am away.
|
|
|
- 7). Becoming A DVD Repair Expert Online By : Maxine Schel
Many conventional colleges and universities are now offering online DVD repair courses, which are the exact same as those taught on a traditional college campus, to distance learners. Online education is generally taught through the use of several different methods, including online satellite feeds, correspondence or online lessons. This technique permits the student to obtain a DVD repair degree without ever having to step inside of a classroom.
|
- 8). Compatible Inkjet Cartridge By : Isabel Rodrigues
Once the printer ink runs dry it has to be replaced with another inkjet cartridge. There are many reputed companies like Canon, Epson, Dell, and Lexmark that provide the necessary cartridges to replace the empty cartridges. Replacing inkjet cartridge can add to a very big cost. It could be worse if you have to replace the empty cartridges frequently every month.
|
- 9). Best Passwords By : Richard Romando
No sane person would ever like someone else reading her email. Or for that matter some other person using her password and breaking into a financial institution. You should, therefore, choose a strong, secure password in such a manner that would be a hard nut to crack for others and easy for you to remember. The more random and mixed-up you make it, the harder it is for others to crack.
|
- 10). Home Printing Machines By : Peter Vermeeren
Home printing machines are available on the market today in many sizes, prices and capabilities. Many different forms of printing can be accomplished in the home. Whether you want to create unique tee-shirts using a home screen printing machine or you want to produce elegant laser printed letters, the equipment is readily available to you for home use.
|
|
|