CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1
Announcements If this is your first class, pick up a syllabus. Reminder: no recitations this week! 2
Today’s lessons A computer is a very simple machine. All information is encoded using bit strings. We decide how to interpret a bit string. We program computers using high- level languages. 3
physical vs. logical perspectives Physical reality: Logical view: WIRE Carries a HIGH voltage or a LOW voltage WIRE Carries a 1 or a 0 4
Idea 5
Controlling flow 0 6
1 7
Two in a row? 0 8
AND gate For which input values is output 1? For which input values is output 0? Inputs are on left Output is on right 9
OR gate For which input values is output 1? For which input values is output 0? Inputs are on left Output is on right 10
NOT gate For which input value is output 1? For which input value is output 0? Input is on left Output is on right 11
Flip-flop (a bit of memory!) S (set) R (reset) remembered value 12
Counting Decimal (base 10) etc. Binary (base 2) etc. 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 14
Number systems Decimal (base 10) Each position is weighted by a power of 10. E.g. 734 = –7* *10 + 4*1 –7* * *10 0 E.g = –1* * *10 + 1*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 0 E.g = –1*8 + 1*4 + 0*2 + 1*1 = “thirteen” –1* * * *2 0 15
Interpretation QUESTION: –What does the bit string 1101 represent? 16
Interpretation QUESTION: –What does the bit string 1101 represent? ANSWER: –Whatever we want it to represent! 17
Representations Binary (non-negative numbers) Two’s complement (integers) IEEE 754 (approx. floating point numbers) ASCII / EBCDIC / Unicode (characters) etc. 18
Questions? 19