7315 Hardware abstraction 2 Logic gates What really

7/3/15 Hardware abstraction #2 Logic gates What really goes on inside of computers? CS Matters in Maryland – CS Principles 1

We know computers are excellent at calculating 2 � Computers are fast and accurate. � But how do they do it? CS Matters in Maryland – CS Principles 7/3/15 – page 2 http: //lowres. jantoo. com/accounting-accountancy-business_accoun

We know everything is stored in binary http: //homepage. cs. uri. edu/book/binary_data_files/binary 5. jpg �So calculations must be in binary 12 + 12 = 102 in binary.

Inside each tiny chip in a computing device �Is a maze of circuits to process the 0’s and 1’s What do you need inside of a chip to be able to do math? 1. A place to store the numbers. 2. A way to process the numbers. 3. Communication lines to get the numbers from one place to another.

If you could see inside a chip �Like a miniature city with busy roads and buildings filled with information, the computer CPU chip (processor) operates at millions or billions of processes each second. http: //2. bp. blogspot. com/-YLJ 9 j. MWPvfo/U 2 ik. Sd. CMBWI/AAAAGMY/bx 67 j Galaxy-5 -4. jpg

Abstractions (what’s inside? ) �The CPU is composed of many circuits �Circuits are composed of many logic gates. �This is also true for RAM and each of the cards installed in a computing device. �If you think about everything that happens each time you press a key, you will soon see why abstractions are so important to computer science Each chip does a specific task with its own logic circuits ts in ircui side ch of ea chip C http: //www. mobilephones. com/assets/images/website_

Let’s follow some bits through a calculation �The number 7 is pressed on a keyboard. https: //thumbs. dreamstime. com/t/young-girl-pressing-virtual-type-keyboard-29948827. jpg The binary form of 7 is sent to the CPU to be processed 0 0 8 bits = 0 1 byte 1 1 1

The 7 is stored in temporary storage 00000111 A “+” sign is pressed The algorithm for addition is invoked and will start when the 2 nd number is entered. Binary addition 1) Start with the rightmost bit 2) Add the bits using the chart on the left 3) Carry over the left most digit in the sum …. http: //chortle. ccsu. edu/assemblytutorial/Chapter-08/binary. Addition. Table. gif

The digits 2 and 1 are pressed, followed by an “=“ sign (or the ENTER key) �The number 21 is stored in memory next to the 700010101 �The addition algorithm adds each column of bits, starting on the right and carrying any extra bits over to the left as it does each calculation

Addition is done with logic circuits Logic circuits are made up of logic gates The computer can only add up 1 column of numbers at a time These are the symbols for logic gates. http: //www. electronicshub. org/wp-content/uploads/2015/06/Full-adder. jpg

The AND gate

� In a complete sentence, describe the AND gate inputs that lead to an output of 1.

Another logic gate: the inverter �The inverter changes a signal to its opposite �A 0 becomes a 1 �A 1 becomes a 0

These are the logic gates in an addition circuit The computer can only add up 1 column of numbers at a time 2 bits go in, A and B A+B comes out The carry bit moves over to the next column 0+0= 0 0+1= 1 1+0= 1 1 + 1 = 10 http: //www. electronicshub. org/wp-content/uploads/2015/06/Full-adder. jpg

How do logic gates add 2 digits? �This is an exclusive OR gate (XOR) �If either one or the other of the inputs (but not both) is a “ 1” then the output will be a “ 1”. �Which of these will produce an output of “ 1”? 0+0= 0+1= 1+0= 1+1= Only count the rightmost, sum, bit The carry bit has it’s own, separate logic circuit

What if there is a carry bit coming into the circuit? �A truth table can show every possibility: Then there are 3 input bits: A, B and C Fill in the truth table

The circuit to calculate the carry bit is more complicated. �It uses 3 different kinds of logic gates XOR, AND, OR

The OR gate produces an output of “ 1” if any input is a “ 1” Fill in the truth table �Learn lots more at all. About. Circuits. com http: //www. allaboutcircuits. com/textbook/digital/chpt 3/multiple-input-gates/

The deeper you look into what is happening The better you can understand what is really going on inside of a computing device. Transistors are switches inside of gates to make them work. If either the A switch or the B switch is a on (“ 1”) then the output will also be on (“ 1”) http: //study. com/cimages/multimages/16/computer_video_card_annotated_600. jpg From low level transistors To high level components like video cards

Look at how the abstractions build up Computing devices Motherboard / circuit boards / storage devices Memory / processors Chips Logic gates Transistors, switches, wires

Sample questions: �Given that: � 1 is True Logic problem: � 0 is False What is the answer to each logic problem if: A is True A and 1 A or 1 A XOR 0 NOT A A is False

Sample AP ® level question: � What are all the possible values for A and B that could make the output of this circuit true? (1) A AND output 1 OR B NOT

Careers in circuit design: �Chip designers create circuits using logic gates that are fast and efficient. �http: //createacareer. org/computer-information-technology/computer -hardware-engineer-careers/
- Slides: 23