How Computers Work, Lecture Notes - Computer Science, Study notes of Introduction to Computers

Bits, Building Block, Logic Gates, AND OR XOR Gates, Base-2 Addition, Column Adder, Level of Abstraction

Typology: Study notes

2010/2011

Uploaded on 10/07/2011

rolla45
rolla45 🇺🇸

4

(6)

133 documents

1 / 41

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
How Computers Work
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29

Partial preview of the text

Download How Computers Work, Lecture Notes - Computer Science and more Study notes Introduction to Computers in PDF only on Docsity!

How Computers Work

Review

 When we compute, we operate on discrete / digital values.  Examples of digital machines:

The Most Important Part

 What is the most important part of your computer?  Your computer's processor (CPU)  What companies manufacture CPUs? Intel, AMD, etc.  The processor is the computer's brain.  It's what runs your programs.

Today's Plan

 Lofty Goal: Learn how processors work.  But: Your processor is a complex digital machine.  So: Learn how simple digital machines work.  Hope: Give you a sense for how some of the things inside your processor work.  (This is what ECE majors study.)

How many possible values ...

 ... can I represent with 2 bits? 4: 00, 01, 10, 11  ... can I represent with 3 bits? 8: 000, 001, 010, 011, 100, 101, 110, 111  ... can I represent with n bits? 2 n

How many bits do I need ...

 ... to represent 3 possible values? 2  ... to represent 6 possible values? 3  ... to represent 20 possible values? 5

Bits and Voltage

 Lower voltage = "0"  Higher voltage = "1"  Each wire carries a single bit.  We can literally determine whether a wire is carrying a "0" or a "1" by measuring the voltage on that wire.

Our Building Blocks

 A NOT Machine  Its Truth Table 1 0 0 IN OUT 1 NOT IN OUT 0 = false 1 = true

Our Building Blocks

 An OR Machine  Its Truth Table 0 1 1 1 0 B OUT 1 0 A 0 0 1 1 1 B A OUT OR

Logic Gates

 These 3 machines are referred to as logic gates.  An AND machine (for example) is referred to as an AND gate.

A Detour: Happy Robots

 The robot is happy if leftHasWall() or rightHasWall() , but not both. lonely claustrophobic happy happy

Write isHappy without an if

 public static boolean isHappy() { return _______________________ _______________________; } (leftHasWall() &&! rightHasWall()) || (! leftHasWall() && rightHasWall())

Building An XOR Machine

 (A AND (NOT B)) OR ((NOT A) AND B)

AND OUT OR NOT NOT AND A B

Remember: Abstraction

 Once we defined turnRight to mean Robot.turnLeft(); Robot.turnLeft(); Robot.turnLeft();  we could now think of turnRight as one of our building blocks.  This idea is called Abstraction.