1 / 50

Memory

Memory. Memory. The logic and arithmetic circuits we’ve seen so far have no memory. They just transform input to output. Can we make circuits that remember?. The Stubborn Guy. Matt really likes Sue , but he doesn’t like changing his mind… So:

Télécharger la présentation

Memory

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. Memory

  2. Memory • The logic and arithmetic circuits we’ve seen so far have no memory. They just transform input to output. • Can we make circuits that remember?

  3. The Stubborn Guy • Matt really likes Sue, but he doesn’t like changing his mind… So: • Matt decides to go to the party if Sue decides to go OR if he (Matt) had already planned to go.

  4. OR He Needs Feedback (from Himself) • Matt decides to go to the party if Sue decides to go OR if he (Matt) had already planned to go. • Two inputs to Matt’s decision: Sue, and his own state Sue Matt Feedback Wire

  5. OR The Stubborn Guy: Feedback • Matt decides to go to the party if Sue decides to go OR if he (Matt) had already planned to go. • If Sue decides to go... 1 Sue Matt

  6. OR The Stubborn Guy: Feedback • Matt decides to go to the party if Sue decides to go OR if he (Matt) had already planned to go. • If Sue decides to go, Matt will go. 1 Sue 1 Matt 1

  7. OR The Stubborn Guy: Feedback • Matt decides to go to the party if Sue decides to go OR if he (Matt) had already planned to go. • If Sue changes her mind… 0 Sue 1 Matt 1

  8. OR The Stubborn Guy: Feedback • Matt decides to go to the party if Sue decides to go OR if he (Matt) had already planned to go. • If Sue changes her mind, Matt will still go! • Once he decides to go, we can’t get him to change his mind 0 Sue 1 Matt 1

  9. Enter Rita • Matt doesn’t like Rita • Matt decides to go to the party if Sue decides to go OR: • If he (Matt) had already planned to go AND Rita decides NOT to go.

  10. 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) had already planned to go AND Rita decides NOT to go. Sue Matt Rita Feedback Wire

  11. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 0 Matt 1 0 0 Rita 0

  12. 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) had already planned to go AND Rita decides NOT to go. 1 Sue 0 Matt 1 0 0 Rita 0

  13. 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) had already planned to go AND Rita decides NOT to go. 1 Sue 1 Matt 1 1 0 Rita 1

  14. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 1 Matt 1 1 0 Rita 1

  15. 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) had already planned to go AND Rita decides NOT to go. 0 – nothing changes: Sue can make Matt go, but cannot make him not go Sue 1 Matt 1 1 0 Rita 1

  16. AND OR Enter Rita • Matt doesn’t like Rita (maybe together they can make him not go) • Matt decides to go to the party if Sue decides to go OR: • If he (Matt) had already planned to go AND Rita decides NOT to go. 0 Sue 1 Matt 1 1 1 Rita 1

  17. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 1 Matt 0 1 1 Rita 1

  18. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 1 Matt 0 0 1 Rita 1

  19. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 0 Matt 0 0 1 Rita 1

  20. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 0 Matt 0 0 1 Rita 0

  21. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 0 Matt 0 0 0 Rita 0

  22. 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) had already planned to go AND Rita decides NOT to go. 0 Sue 0 Matt 1 0 0 Rita - no change 0

  23. What Sue and Rita Can Do • Sue can make Matt go, but cannot make him not go • Rita can make Matt not go, but cannot make him go

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

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

  26. What We Really Want D M W • Nothing happens unless Write = 1 • If Write = 1, then M becomes set to D • Once Write = 0 again, M just keeps its value. (It ignores D.) • So, to set M to a value and store it as long as desired, set D to that value, then set W to 1 and then back to 0

  27. AND AND The Data Flip-Flop S D Write M R • Nothing happens unless Write = 1

  28. AND AND The Data Flip-Flop S D Write M R • Nothing happens unless Write = 1 • If Write = 1, then M becomes set to D • Once Write = 0 again, M just keeps its value. (It ignores D.)

  29. AND AND Using a Data Flip-Flop 0 S D 1 Write 0 M R 0 • Initially, Write = 0.Let’s say M = 1.

  30. AND AND Using a Data Flip-Flop 0 S 0 D 1 Write 0 M R 0 1 • Initially, Write = 0.Let’s say M = 1. • First, set D to desired value, say 0.

  31. AND AND Using a Data Flip-Flop 0 S 0 D 1 Write 1 M R 1 1 • Initially, Write = 0.Let’s say M = 1. • First, set D to desired value, say 0. • Then, set Write to 1.

  32. AND AND Using a Data Flip-Flop 0 S 0 D 0 Write 1 M R 1 1 • Initially, Write = 0.Let’s say M = 1. • First, set D to desired value, say 0. • Then, set Write to 1. • This causes M to be reset to 0. • Note use of abstraction with regard to SR flip-flop

  33. AND AND Using a Data Flip-Flop 0 S ? D 0 Write 0 M R 0 1 • Initially, Write = 0.Let’s say M = 1. • First, set D to desired value, say 0. • Then, set Write to 1. • This causes M to be reset to 0. • Finally set Write back to 0. Now D is irrelevant.

  34. 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

  35. Are We Done?

  36. A Subtle Problem D M ?? Write • When Write = 1, then M = D. • If we have some feedback between M and D,then circuit could go haywire.

  37. NOT A Subtle Problem ? D ? M 1 Write • For example, suppose a NOT gate connects M and D. • When Write = 1, M and D keep changing. We have no control.

  38. NOT A Subtle Problem ? D ? M 1 Write • We want to control the feedback, so that each time we set Write to 1 and then back to 0, M stores only the last value of D • (In this case, M should invert itself once each time we set Write to 1 and back to 0)

  39. The “Airlock” Flip-Flop “Outer door” “Inner door” M D M1 D1 D0 M0 Write W1 W0 • Two-Stage System to prevent D ever passing through directly to M (W0,W1 connected by NOT, so never 1 at the same time)

  40. The “Airlock” Flip-Flop “Outer door” “Inner door” M D M1 D1 D0 M0 Write W1 W0 • We start with Write = 0. • Let’s say D is always NOT M; i.e. connected by NOT gate.Start with D = 0, M = 1.

  41. The “Airlock” Flip-Flop “Outer door” “Inner door” 0 M 1 1 D M1 D1 D0 M0 1 0 Write W1 W0 • We start with Write = 0. • Let’s say D is always NOT M; i.e. connected by NOT gateStart with D = 0, M = 1.

  42. The “Airlock” Flip-Flop “Outer door” “Inner door” 0 M 1 1 D M1 D1 D0 M0 0 1 Write W1 W0 • Want to store D in memory. • Set Write to 1

  43. The “Airlock” Flip-Flop “Outer door” “Inner door” 0 M 1 0 D M1 D1 D0 M0 0 1 Write W1 W0 • Want to store D in memory. • Set Write to 1 • “Outer” flip-flop sets M0 = D0 = 0 • “Inner” flip-flop ignores D1 since W1 = 0

  44. The “Airlock” Flip-Flop “Outer door” “Inner door” 0 M 1 0 D M1 D1 D0 M0 1 0 Write W1 W0 • Now, set Write back to 0

  45. The “Airlock” Flip-Flop “Outer door” “Inner door” 0 M 0 0 D M1 D1 D0 M0 1 0 Write W1 W0 • Now, set Write back to 0 • Now “Inner” flip-flop sets M = D1 = 0

  46. The “Airlock” Flip-Flop “Outer door” “Inner door” 1 M 0 0 D M1 D1 D0 M0 1 0 Write W1 W0 • Because of feedback, D might change to (NOT M) , which is 1 • But Write = 0, so “Outer” flip-flop ignores D, so M0 stays 0.

  47. The “Airlock” Flip-Flop “Outer door” “Inner door” 1 M 0 0 D M1 D1 D0 M0 1 0 Write W1 W0 • So memory does not change until we “toggle” Write. • (“toggle” means change from 0 to 1 or vice versa)

  48. The “Airlock” Flip-Flop “Outer door” “Inner door” M D M1 D1 D0 M0 Write W1 W0 • This is Real Memory!

  49. Memory “Register”: 4 bits Data1 D M W Data2 D M W Data3 D M W Data4 D M Write W

  50. Review • We have used the Universal method to build • ALU • Memory • Next steps • State machines to computer with memory • Building the computer • Writing a program to use the computer

More Related