class8-HowComputersWorkPart1

class8-HowComputersWorkPart1 - How Computers Work How Part...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: How Computers Work How Part 1 Digital When we compute, we operate on discrete/digital values. Examples of digital machines: One Machine To Rule Them All If you have a digital machine, and you want to change what it can do, you need to re-wire it. Alan Turing's Big Idea (1936): We can build a single universal digital machine that can be programmed to simulate any other digital machine. That single universal digital machine is called a computer. Your computer can be programmed to simulate any digital machine. Same hardware Different software What's inside your computer? What's CPU Central Processing Unit Your computer's processor Example: Intel's Pentium Processor Sounds important. How does it work? Today's Plan Learn how simple digital machines solve specific problems Learn how a computer processor works (This is what ECE majors study.) Bits Computers use just 2 discrete values. We can think of them as meaning true or false, yes or no, 1 or 0, etc. Each true/false, yes/no, or 1/0 is a single bit. What do bits look like? What How do we represent a "1" or "0"? On your hard drive? direction of magnet On a CD? indentations and non-iindentations that determine how ndentations much light is reflected back from a laser much In memory and in your CPU? high or low voltage Voltage Voltage Everything here is 3 volts higher than + 3-Volt Battery - Some Resistance Some Resistance everything here Bits and Voltage Bits Higher voltage = "1" Lower voltage = "0" Each wire carries a single bit. Controlling Switches With Bits “0” “1” “0” “1” Relay 1835 Vacuum Tube 1906 Transistor 1947 (semiconductors) Our First Logic Gate Our “1” IN OUT “0” Our First Logic Gate Our “1” “1” IN = "1" OUT = ? IN = "1" OUT = "0" “0” “0” Our First Logic Gate Our “1” “1” IN = "0" OUT = ? IN = "0" OUT = "1" “0” “0” What does this logic gate do? This is a NOT Gate Logic Gates with 2 Inputs Logic “1” “1” B A OUT A OUT B “0” AND Gate OR Gate “0” Layers of Abstraction Layers Transistors can be combined to can form logic gates. form We name these gates, We and they become new building blocks. building We can now combine We these to build more complex devices. complex NOT Truth Tables NOT: IN 0 1 B 0 1 0 1 OUT 1 0 OUT 0 0 0 1 OR: A 0 0 1 1 B 0 1 0 1 OUT 0 1 1 1 AND: A 0 0 1 1 XOR XOR A 0 0 1 1 B 0 1 0 1 OUT 0 1 1 0 Can we use not/and/or gates to build an Can XOR gate? XOR XOR XOR A 0 0 1 1 B 0 1 0 1 OUT 0 1 1 0 AB NOT AND OR AND OUT NOT Adding Bits 0+0= 0 0+1= 1 1+0= 1 1 + 1 = 10 How many bits do we need to represent the sum of 2 bits? ADD A 0 0 1 1 B 0 1 0 1 OUTHI 0 0 0 1 OUTLO 0 1 1 0 AB AND OUTHI XOR OUTLO Integers How can we use bits to represent 0, 1, 2, 3, ... ? Binary: 000 001 010 011 100 101 110 111 = = = = = = = = 0 1 2 3 4 5 6 7 Binary (Base 2) 8s 0 0 1 4s 1 1 1 2s 0 1 0 1s 1 1 0 In Base 10 5 7 12 Adding in Binary Adding 1 1 101 +111 1100 How many bits do I add in each column? A device that can add one column will need 3 inputs and 2 outputs. Adding 3 Bits Adding A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 Carry-in 0 1 0 1 0 1 0 1 Carry-out Sum 0 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1 Adding 3 Bits Adding A B Carry-in AND A AND AND OR Carry-out Carry-out + Carry-in B XOR XOR OUT OUT Adding two 3-bit numbers Adding 1 0 1 1 1 1 + 1 + 1 + 0 1 1 0 0 What does this device do? What SEL A B AND NOT OR AND OUT SEL 0 0 0 0 1 1 1 1 A 0 0 1 1 0 0 1 1 B 0 1 0 1 0 1 0 1 OUT 0 0 =A 1 1 0 1 =B 0 1 Selector Selector SEL A B A OR AND OUT SEL 0 B 1 AND NOT OUT Combinational Logic Combinational XOR, Adders, and Selectors are examples XOR, of combinational logic, where we combinational where combine not/and/or. combine Any chunk of combinational logic Any corresponds to a truth table. corresponds Key Points Key Hardware = wires, transistors, chips Software = bits (voltages on wires) Layers of Abstraction: We can use transistors to build logic gates. We can use logic gates to perform arithmetic. Given a truth table, we can build an equivalent circuit Given using not/and/or gates. using Given a circuit with not/and/or gates, we can write an Given equivalent truth table. equivalent ...
View Full Document

Ask a homework question - tutors are online