1 / 36

CSE115: Introduction to Computer Science I

CSE115: Introduction to Computer Science I. Dr. Carl Alphonce 219 Bell Hall alphonce@buffalo.edu. Announcements. Recitations begin next week for TWF groups. Th recitations begin the week after. Put your name sign out! Cell phones off. Today. Representing things information encoding

cahil
Download Presentation

CSE115: Introduction to Computer Science I

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. CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall alphonce@buffalo.edu

  2. Announcements • Recitations begin next week for TWF groups. Th recitations begin the week after. • Put your name sign out! • Cell phones off.

  3. Today • Representing things • information encoding • symbol interpretation • A computer is a very simple machine • it manipulates voltages • gates are used to control voltage flow • circuits are combinations of gates • a flip-flop is a circuit that remembers • But first…

  4. Name sign competition • And the winners are: • 9:00 AM – KAYLA • 3:00 PM – STEPHANIE

  5. Counting Decimal (base 10) Binary (base 2) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 etc. 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 etc.

  6. Number systems Decimal (base 10) Binary (base 2) Each position is weighted by a power of 2. E.g. 111 = 1*4 + 1*2 + 1*1 = “seven” 1*22 + 1*21 + 1*20 E.g. 1101 = 1*8 + 1*4 + 0*2 + 1*1 = “thirteen” 1*23 + 1*22 + 0*21 + 1*20 • Each position is weighted by a power of 10. • E.g. 734 = • 7*100 + 3*10 + 4*1 • 7*102 + 3*101 + 4*100 • E.g. 1101 = • 1*1000 + 1*100 + 0*10 + 1*1 • 1*103 + 1*102 + 0*101 + 1*100

  7. Same informationDifferent encoding • Color (RGB & CMYK) • Quantity (Decimal & Binary)

  8. Bit string • A ‘0’ or ‘1’ is a binary digit, or a bit. • A sequence of bits is called a bit string. • For example: • 1101 is a bit string

  9. Interpretation • QUESTION: • What does the bit string 1101 represent?

  10. Interpretation • QUESTION: • What does the bit string 1101 represent? • ANSWER: • Whatever we want it to represent!

  11. Bit-string representations(used in computers) • Binary (non-negative numbers) • Two’s complement (integers) • IEEE 754 (approx. floating point numbers) • ASCII / EBCDIC / Unicode (characters) • etc.

  12. Questions?

  13. physical vs. logical perspectives • Physical reality: • Logical view: Carries a HIGH voltage or a LOW voltage WIRE Carries a 1 or a 0 WIRE

  14. Idea

  15. Controlling flow 0

  16. Controlling flow 1

  17. Two in a row? 0

  18. Two in a row? 0

  19. Two in a row? 0

  20. Two in a row? 1

  21. AND gate output is on right 0 or 1 inputs are on left For which input values is output 1? For which input values is output 0?

  22. Truth table for AND

  23. OR gate output is on right inputs are on left For which input values is output 1? For which input values is output 0?

  24. Truth table for OR

  25. NOT gate input is on left output is on right For which input value is output 1? For which input value is output 0?

  26. Truth table for NOT

  27. Flip-flop (a bit of memory!) R (reset) remembered value S (set)

  28. Setting the flip-flopThe normal value of R and S is zero. R (reset) = 0 remembered value S (set) = 0

  29. Setting the flip-flopTo store 1 in the flip-flop, we “raise” S to 1… R (reset) = 0 remembered value S (set) = 1

  30. Setting the flip-flop…which makes the output of the OR gate 1. R (reset) = 0 remembered value 1 S (set) = 1

  31. Setting the flip-flopThe NOT gate inverts this 1 value to 0, which becomes the second input to the upper OR gate. R (reset) = 0 remembered value 0 1 0 S (set) = 1

  32. Setting the flip-flopSince both inputs of the upper OR gate are zero, its output is zero. R (reset) = 0 0 remembered value 0 1 0 S (set) = 1

  33. Setting the flip-flopThe NOT gate inverts this 0 to a 1; this value becomes the second input to the bottom OR. R (reset) = 0 1 0 remembered value 0 1 1 0 S (set) = 1

  34. Setting the flip-flopBecause the output of the bottom OR gate will now stay at 1, we can lower S to zero, and the circuit will stay in a stable state, with 1 as the remembered value! R (reset) = 0 1 0 remembered value 0 Resetting the flip-flopResetting the remembered value to zero is similar, except we raise, then lower, the value on R. 1 1 0 S (set) = 0

  35. Recap • Bit string by itself does not carry meaning. • Bit string can be interpreted under a given representation scheme, which allows us to recover the encoded meaning. • Circuits made from simple gates let us store and manipulate bit strings.

  36. Questions?

More Related