| We looked at Number Systems and counting (see It's | | | | duplicate with a logic circuit the way we add in binary. |
| a Binary World - How Computers Count) last time. As | | | | To add 1+1 we need 3 inputs, one for each bit, and a |
| a quick refresher, we saw that computers are made | | | | carry in - and 2 outputs, one for the result (1 or 0), and |
| up of many units of 0 and 1, the binary system. 1 is the | | | | a carry out, (1 or 0). In this case the carry input is not |
| highest digit possible so numbers in the computer are | | | | used. We use 2 XOR gates, 2 AND gates and an OR |
| stored as for example 1010 or 10 in decimal. We also | | | | gate to make up the adder for 1 bit.Now we go |
| saw that these binary numbers can be seen as octal | | | | another step, and forget about gates, because now |
| (8) or hexadecimal (16) numbers - in this case 1010 | | | | we have a Logic Block, an ADDER. Our computer is |
| becomes 15 octal, or A hex.You probably realise that | | | | designed by using various combinations of logic blocks. |
| the 'standard' PC code is in 8 bit bytes taking the hex | | | | As well as the adder we might have a multiplier (a |
| system a stage further. You may also know that | | | | series of adders) and other components.Our ADDER |
| processors, and Windows software that runs on them, | | | | block takes one bit (0 or 1) from each number to be |
| have progressed from 8 bits to 16 bits to 32 bits to 64 | | | | added, plus the Carry bit (0 or 1) and produces an |
| bits. | | | | output of 0 or 1, and a carry of 0 or 1. A table of the |
| Basically this means the computer can work on 1,2, 4 | | | | input A, B and carry, and output O and Carry, looks like |
| or 8 bytes at once. Don't worry if this is all | | | | this:-With no Carry in:A B c O C |
| Gobbledegook, you don't need it to understand how | | | | 0 0 0 0 0 |
| computers add!OK now to the Math - cringe time! It's a | | | | 1 0 0 1 0 |
| little more complicated than last time, but if you think | | | | 0 1 0 1 0 |
| logically, like a computer, realising they are really dumb, | | | | 1 1 0 0 1With Carry in:A B c O C |
| you will sail through it!We take a break here to look at | | | | 0 0 1 1 0 |
| a bit of math you may not have heard of - Boolean | | | | 1 0 1 0 1 |
| Algebra. Once again it's really simple, but it shows you | | | | 0 1 1 0 1 |
| how a computer works, and why it is so | | | | 1 1 1 1 1 This is known as a Truth Table, it shows |
| pedantic!Boolean Algebra is named after George | | | | output state for any given input state.Let's add 2+3 |
| Boole, an English Mathematician in the 19th Century. He | | | | decimal. That is 010 plus 011 binary. We will need 3 |
| devised the logic system used in digital computers | | | | ADDER blocks for decimal bit values of 1, 2 and 4)The |
| more than a century before there was a computer to | | | | first ADDER takes the Least Significant Bit (decimal bit |
| use it!In Boolean Algebra, instead of + and - etc. we | | | | value 1) from each number. Input A will be 0 Input B will |
| use AND and OR to form our logic steps.For | | | | be 1With no carry - 0.From the truth table this gives an |
| example:-x OR y = z means if x or y is present, we | | | | output of 1 and a carry of 0 (3rd row).BIT 1 RESULT = |
| get z.However,x AND y = z means that both x and y | | | | 1At the same time the next ADDER (decimal bit value |
| need to be present to get z.We can also consider an | | | | 2) has inputs of A - 1, B - 1 and a carry of 0, giving an |
| XOR (eXclusive OR).x XOR y=z means that x or y | | | | output of 0 with a carry bit of 1 (4th row).BIT 2 |
| BUT NOT BOTH must be present to get z.That's it! | | | | RESULT = 0At the same time the next ADDER |
| That's all the math you need to understand how a | | | | (decimal bit value 4) has inputs ofA - 0, B -0 and a |
| computer adds. Told you it was simple!How do we | | | | carry of 1, giving an output of 1 with no carry - 0 (5th |
| use this logic in the computer? We make up a little | | | | row). |
| electronic circuit called a Gate with transistors and | | | | BIT 4 RESULT = 1.So we have bits 4,2,1 as 101 Binary |
| things, so we can work on our binary numbers stored | | | | or 4+0+1=5 decimal.It seems like a laborious way to do |
| in a register - just a bit of memory. (And that's the last | | | | it, but our computer can have 64 adders or more, |
| electronics you'll hear about!). We make an AND gate, | | | | adding simultaneously two large numbers billions of |
| an OR gate, and an XOR gate.When we add in | | | | times a second. This is where the computer |
| decimal, for example 9+3 we get 2 'units' and carry | | | | scores.Next time we will get to how a computer |
| one to the 10s, giving 10+2=12Remember the binary bit | | | | performs more complcated operations, and it's |
| values in Decimal - 1,2,4,8 etc? We start at 0, then 1 in | | | | simple!Tony is an experienced computer engineer. He |
| the first bit position, the 1 bit. If we add 1 + 1 binary we | | | | is currently webmaster and contributer to looking at |
| have to end up with 10, which has a 1 bit in the second | | | | things you can do At Home. A set of diagrams |
| bit position, and a 0 in the first, giving Decimal | | | | accompanying these articles may be seen on that |
| 2+0=2. This second bit position is formed by a | | | | website. Go to to start. |
| CARRY from the first bit.To make an adder we must | | | | |