How computers do arithmetic operations using logic gates- Maite Zuniga
Grade 6
Presentation
Problem
Question- What goes in to a computer for it to be able to do such quick operations?
Project title- How computers do arithmetic operations using logic gates
Method
I did not preform an experiment in this project. But I did build a wooden computer to demonstate the process of addition within a computer. For the demonstration I used marbles representing electrical current: I put a marble in the correct inputs to represent the first number and repeated that step for the second number, then I pushed the lever up and let the marbles go through the logic gates to be added.
Research
Introduction
When I started this project I had a goal of building something that showed how computers think and do arithmetic operations using logic gates and binary numbers in a fun and engaging way, so not only would I learn but also those who took the time to listen to our presentation.
Binary numbers- what are they?
To understand computers and how they do math we have to understand binary numbers and their importance in computers.
Binary numbers are a fundamental concept in computer programming. They are expressed in a base 2 numbers system, meaning there are only 2 numbers in the number system, those numbers being zero and one. For comparison, the decimal number system, our number system, also known as the base 10 decimal number has ten numbers, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. One similarity the number systems share is that all the other numbers in the number system are composed of those base numbers, whether two (in binary) or ten (in decimal). The advantage of binary numbers is that they are represented using ones and zeros, on or off, true or false… In a computer the ones or zeros would be signals either on or off.
Binary numbers- bits and place value
The digits of a binary number are referred to as bits, or binary digits. The place value in binary numbers from right to left is 1,2,4,8 and so on, depending on the number of bits the number has. Let's use 13 as an example. The binary number of 13 is 1101, because 13 is made up of one 8 plus one 4, zero 2 and one 1. In other words: 8 + 4 + 1 = 13
The registers in a computer have a fixed number of bits, so let's say the register has four bits, and your binary number is 10 (or 2 in decimal); as I previously explained, this means zero eights, zero fours, one two, and zero ones. So, the number 2 in our 4-bit register would be represented as 0010 (even though there are 2 extra zeros it does not matter as the only place value activated is 2 so zero eights, zero fours, one twos and zero ones still has a sum of 2).
Binary numbers- how to convert decimal numbers to binary numbers
Step 1: Take your decimal number and divide by 2. Write down your quotient and remainder
Ex: 29/2 = 14 R1
Step 2: Take the quotient and divide by 2. Write down you quotient and remainder
Ex: 14/2 = 7 R0
Step 3: Repeat step 2 until the quotation is zero
Ex: 7/2 = 3 R1, 3/2 = 1 R1, 1/2 = 0 R1
Step 4: Take the remainders from your most recent to your first.
EX: 11101
But how do you know its correct? Well, like I previously mentioned place value from right to left goes 1, 2, 3, 4 and so on, so with this number there is one 1, zero 2s, one 4, one 8 and one 16. Clearly, 1+4+8+16 = 29
Binary numbers from one to twenty
1 = 1 6 = 110
2 = 10 7 = 111
3 = 11 8 = 1000
4 = 100 9 = 1001
5 = 101 10 = 1010
11 = 1011 16 = 10000
12 = 1100 17 = 10001
13 = 1101 18 = 10010
14 = 1110 19 = 10011
15 = 1111 20 = 10100
Binary numbers- how to add them
Step one: Line up your numbers like you would in decimal addition.
Step two: Start on the right and make your way to the left working with each place value. 0 + 0 = 0, 1 + 0 or 0 + 1 = 1. Now if your adding 1 + 1, the answer would be two (or 10), but just as with decimal numbers when the sum is greater than 9, you take the unit and take the carry over to add to the next place value digits.
Example: 11 + 7 = 18
Logic gates- what are they
A logic gate performs a logical operation to test if the relationship between two expressions is true or false. In computers, the bits are expressions that can be false (zero) or true (one). A logic gate then take 2 bits and convert them into a single binary output, true or false (zero or one) depending on the state of the inputs and the logic operation. The logic operations could be AND, OR or XOR.
AND
When both inputs are false, or one input is true but the other input is false, the output is false. Only When one input AND the other input are true the output is true.
OR
The output of this gate is true when one input OR the other input, OR both inputs are true.
XOR
(exclusive or)
Only when one OR the other input are true the output is true. When both inputs are true or false, the output is false.
Logic gates and adding binary numbers
- When adding two bits a + b = c, the result is one when either a or b are one, but if both are one, then the result is zero and there is a carry over to the next place value digits. This is an XOR gate !!!
- On the other hand, the carry over is one only when a and b are one. This is an AND gate !!!
- So, by combining many AND gates and XOR gates (and OR gates) we can implement the logic needed to add two 4-bit binary numbers.
A modern computer uses the flow of electricity (electric current) powered by voltage. By redirecting the flow of said current using components called “transistors”, computer engineers can implement the logic gates.
In my experiment I’m using the flow of marbles powered by gravity and the wood mechanism to control the flow of the marbles implementing the logic gates.
“Same principle, same idea, just different technologies to implement it…”
The difference between an electronic computer and my experiment is that an electronic computer can pack millions of transistors in a tiny microchip that will function millions or times faster than my block of wood and handful of marbles.
For example The Tim-BITS 2000 adds two 4-bit numbers in about eight seconds, the fastest electronic computer in the world, called Frontier, can do one quintillion (which is 1000000000000000000) operations of numbers of up to 64 bits in just one second!!! This is so fast that if every person in the entire world decided to do what frontier does in one second, it would take us approximately four years non stop.
Conclusion
This project is meant to show how a computer thinks and does arithmetic operations. With all the infromation I collected and presented I can come to the confident conclusion that with the proper materials and knowledge you can implement the mechanisims nessecary to add or subract binary numbers the way a computer would. I can confidently say that my project has answered the question I had when I first started it, which was "What goes into a computer to make such quick operations possible?"
Citations
Acknowledgement
I acknowledge the wonderfull planning that made the science fair possible and my amazing dad for letting me interview him to make my project possible.