Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.

Similar presentations


Presentation on theme: "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1."— Presentation transcript:

1 CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall alphonce@buffalo.edu 1

2 Announcements First class? Print a syllabus from web site. Turn in syllabus signature sheet if you haven’t already done so. No recitations this week – they begin next week. Nothing to prepare (but make sure you have your UBIT name and password). 2

3 cell phones off laptops away 3

4 Today Web site tour 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

5 Put your name signs out! And the winners are: 9:00 AM – Steve (for clarity) 3:00 PM – Mary 5

6 Web site tour www.cse.buffalo.edu/faculty/alphon ce/Courses/Fall2011/cse115 6

7 Morse Code Dots, dashes and spaces used to represent letters/digits http://www.planetofnoise.com/midi /morse2mid.phphttp://www.planetofnoise.com/midi /morse2mid.php Two features: –variable length encodings –not a prefix code 7

8 8 Spaces of different lengths is needed to decode unambiguously. Without spaces, how many ways can six dots in a row be decoded? (Image in public domain: http://commons.wikimedia.org/wiki/F ile:Intcode.png)

9 9 5 five cinq

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

11 Number systems Decimal (base 10) Each position is weighted by a power of 10. E.g. 734 = –7*100 + 3*10 + 4*1 –7*10 2 + 3*10 1 + 4*10 0 E.g. 1101 = –1*1000 + 1*100 + 0*10 + 1*1 –1*10 3 + 1*10 2 + 0*10 1 + 1*10 0 Binary (base 2) Each position is weighted by a power of 2. E.g. 111 = –1*4 + 1*2 + 1*1 = “seven” –1*2 2 + 1*2 1 + 1*2 0 E.g. 1101 = –1*8 + 1*4 + 0*2 + 1*1 = “thirteen” –1*2 3 + 1*2 2 + 0*2 1 + 1*2 0 11

12 Same information Different encoding Color (RGB & CMYK) Quantity (Decimal & Binary) 12

13 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 13

14 Interpretation QUESTION: –What does 1101 represent? 14

15 Interpretation QUESTION: –What does the bit string 1101 represent? ANSWER: –Whatever we want it to represent! 15

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

17 Questions? 17

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

19 Idea 19

20 Controlling flow 0 20

21 Controlling flow 1 21

22 Two in a row? 0 22

23 Two in a row? 0 23

24 Two in a row? 0 24

25 Two in a row? 1 25

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

27 Truth table for AND Input 1Input 2Output 000 010 100 111 27

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

29 Truth table for OR Input 1Input 2Output 000 011 101 111 29

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

31 Truth table for NOT InputOutput 01 10 31

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

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

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

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

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

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

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

39 Setting the flip-flop Because 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! 39 Resetting the flip-flop Resetting the remembered value to zero is similar, except we raise, then lower, the value on R. S (set) = 0 R (reset) = 0 remembered value 1 0 0 0 1 1

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

41 Questions? 41


Download ppt "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1."

Similar presentations


Ads by Google