1 / 67

Midterm Review

Midterm Review. October 23, 2001. Administrivia – The Midterm. Problem solving What logic gates do How to build circuits that realize truth tables Addition circuitry Memory State machines to model situations Building the logic for state machines Putting it together to build a computer

Télécharger la présentation

Midterm Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Midterm Review October 23, 2001

  2. Administrivia – The Midterm • Problem solving • What logic gates do • How to build circuits that realize truth tables • Addition circuitry • Memory • State machines to model situations • Building the logic for state machines • Putting it together to build a computer • Programming the computer using machine language • Representing information • Understanding key ideas • Von Neumann machine • Moore’s law

  3. Extra Midterm help • DPD office hours Wednesday 2—4 • My office, CS 219 • Check with qlv and wtcorrea for other hours

  4. More for Less --Moore’s Law • Everything doubles every 18 months • Memory/dollar • Disk/dollar • Transistors per inch • Processor speed • Network bandwidth

  5. Practical Details • Problem sets 20% • Lab reports 10% • Midterm exam 25% • Final exam 25% • Class Participation 20%

  6. Building a computer

  7. Layers of Abstraction • Build more and more powerful tools out of simpler ones. Really Simple Stuff Computers

  8. A Simple Logic Puzzle • Frank will go to the party if Ed goes AND Dan does NOT. • Dan will go if Bob does NOT go OR if Carole goes. • Ed will go to the party if Alice AND Bob go. • Alice and Bob decide to go,but Carol stays home. • Will Frank go to the party?

  9. Using 0’s and 1’s • What do 0’s and 1’s mean? • For now, we’ll take “Natural meanings:” • For example, if we have a variable Alice forwhether Alice goes to the party, • If Alice goes, we write Alice = 1 • If Alice doesn’t, we write Alice = 0 0 = False 1 = True

  10. Logic Gates • Computers are circuits made of Logic Gates. • Logic gates manipulate 0’s and 1’s (False and True) by letting electrons flow or not. • We’ll look at three types of Logic Gates: • AND are all inputs true? • OR is one input true? • NOT flip the truth value

  11. AND Gate X W Z Y AND W X Y Z 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1

  12. OR Gate OR W Z W X Y Z 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 X Y

  13. NOT Gate NOT • “Yanni will go to the party if Xena does NOT go.” Y X Shorthand: Y X X Y 0 1 1 0 Truth Table

  14. AND AND OR Logic Puzzle Circuit Alice Ed Frank Bob Dan Carole Dan will go if Bob does NOT go OR if Carole goes.

  15. Given Any Truth Table A B C F 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0

  16. Given Any Truth Table AND AND AND A B C F 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0 A B C A B C A B C Build AND gate for each output 1

  17. Given Any Truth Table AND AND AND OR A Finally, combine ANDswith an OR gate. B C A F B C A Can build logic for any Truth table this way B C

  18. Universality • Note same idea works no matter how manyinput variables. So for ANY Truth Table we can write down,we can make a circuit for it using only 3 Logic Gates: AND, OR, NOT • This gives us a very powerful tool ! • But, in practice, we are limited in size we can realize – numeracy exercise.

  19. Our First Abstract Tool Universal Method: Circuits for ANY Truth Table 0’s & 1’s Universal Method Computers We are here

  20. Powers of 2 (cont.) • Some rough numbers: • 210  1,000 (103 ) kilo • 220  1,000,000 (106 ) mega RAM • 230  109 giga disk • 240  1012 tera BIG disk • 250  1015 peta • 260  1018 exa knowledge

  21. Representing Information • We represent information with 0’s and 1’s • Numbers • Use binary or hexadecimal • Letters • Use ASCII • Sounds • Use samples • Images • Use pixels

  22. Adding Binary Numbers X Y sum 0 0 0 0 1 1 1 0 1 1 1 0 X Y carry 0 0 0 0 1 0 1 0 0 1 1 1 AND AND AND OR X Y sum X Y X carry Y

  23. Addition We can use 1 building block to add numbers of any length. Black box operation ith bit of X ith bit of Z ith bit of Y carry bit out carry bit Abstraction in action -- This is a piece of a carry-ripple adder

  24. Carry-Ripple Adder Z1 Z2 X2 Universal Circuit For Z2 and carry Z0 X1 Universal Circuit For Z2 and carry X0 Universal Circuit C2 Y2 Y0 Y1 C1 C0 0 Fixed at 0 X2 X1 X0 Y2 Y1 Y0 ============ C2 Z2 Z1 Z0

  25. Memory

  26. AND OR Enter Rita • Matt doesn’t like Rita • Matt decides to go to the party if Sue decides to go OR: • If he (Matt) already feels like going AND Rita decides NOT to go. Sue Matt Rita Feedback Wire

  27. AND OR The Flip-Flop Set M Reset • M becomes 1 if Set is turned on • M becomes 0 if Reset is turned on • Otherwise (if Set and Reset are both 0), M just remembers its value

  28. The Flip-Flop S M R • M becomes 1 if Set is turned on • M becomes 0 if Reset is turned on • Otherwise (if Set and Reset are both 0), M just remembers its value

  29. The Data Flip-Flop D M Write • If Write = 0, M just keeps its value.(It ignores D.) • If Write = 1, then M becomes set to D

  30. D D M M W W D D M M W W D D M M W W D D M M W W RAM • Group 8 of them together. • 8 bits (b)is called abyte (B). • Most RAMis arrangedin bytes.

  31. 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B 1B RAM (cont.) • We want a HUGE number of such 1 byte memory cells. • Problem: How do we indicate which byte ofmemory we want to use at any given time?

  32. 220 bytes of RAM (1 Mega-byte) RAM (cont.) 20 bits of address Address Data Output Data input Write 8 bits (1 byte)of data

  33. Review On our way to building a computer… Represent Info with 0’s & 1’s (aka bits) Logic Circuits: Universal Method 0’s & 1’s Memory Circuits Computers We are here

  34. The System Clock • “500 Mhz Pentium III computer…” • What does “500 Mhz” mean? • It refers to the speed of theSystem Clock.(actually this is only one of the clocks…) • All digital systems have such “Clocks,” even traffic lights and elevator control systems.

  35. Our System: A Traffic Light

  36. A Traffic Light • Intersection of two one-way roads A B Car Sensors

  37. Traffic Light Behavior Otherwise Note:Clock beats every 4 sec.So Light is Yellow for 4 sec. IF A=1 AND B=0 Light A Always Always IF A=0 AND B=1 Otherwise Light B

  38. Traffic Light State Machine Otherwise Note:Clock beats every 4 sec.So Light is Yellow for 4 sec. IF A=1 AND B=0 Light A Always Always IF A=0 AND B=1 Otherwise Light B

  39. Traffic Light States Otherwise IF A=1 AND B=0 01 00 Light A Always Always IF A=0 AND B=1 11 10 Otherwise Light B

  40. M1 M2 ABD1 D2Light A Red Light B Red … 0 0 1 0 0 1 1 0 0 1 * * 1 0 1 0 1 0 0 1 1 1 0 1 1 1 * * 0 0 0 1 0 0 0 0 0 0 1 0 … … … … … … … Traffic Light Behavior Build A Truth Table for next state / Output

  41. Traffic Light Design Current State 2-bit Memory Register Logic For Next State & Output Clock Sensor A 6 Outputs: for eachLight Sensor B

  42. Design for Any State Machine Manybits Current State Memory Register Logic For Next State & Output Clock Inputs Outputs

  43. State Machinesin Real Life • Elevator control systems • Car control systems • VCR’s • Alarm Clocks • Personal Computers • … Just about everything!

  44. Computers

  45. Computer Architecture CPU Keyboard Display Bus Hard Disk CD-ROM RAM

  46. The Bus • Communication on the bus is via postcards • CPU puts “Keyboard, did the user type anything?” (represented in some way) on the Bus. CPU Keyboard Display Bus “Keyboard, did the user type anything?”

  47. The Bus • Each device (except CPU) is a State Machine that constantly checks to see what’s on the Bus. CPU Keyboard Display Bus “Keyboard, did the user type anything?”

  48. The Bus • Keyboard notices that its name is on the Bus,and reads info. Other devices ignore the info. CPU Keyboard Display Bus “Keyboard, did the user type anything?”

  49. The Bus • Keyboard then writes “CPU: Yes, user typed ‘a’.” to the Bus. CPU Keyboard Display Bus “CPU: Yes, user typed ‘a’.”

  50. The Bus • At some point, CPU reads the Bus, and getsthe Keyboard’s response. CPU Keyboard Display Bus “CPU: Yes, user typed ‘a’.”

More Related