{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

mod01

# mod01 - CS 230 Introduction to Computers and Computer...

This preview shows pages 1–19. Sign up to view the full content.

CS 230 - Winter 2011 1-1 CS 230 – Introduction to Computers and Computer Systems Module 1 – Arithmetic, Hardware, Data Martin Karsten [email protected]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-2 Overview number representation boolean algebra and gate logic integer arithmetic non-numerical data types floating point
CS 230 - Winter 2011 1-3 Number Representation radix representation radix also know as base writing natural numbers using a finite alphabet given an n-digit word in base r integer value is d n 1 d n 2 d n 3 ... d 3 d 2 d 1 d 0 0 n 1 d i r i

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-4 Radix Representation humans: base-10, decimal why? computers: base-2, binary why? electrical simplicity analog/digital conversion (high vs. low voltage) low-level decimal conversion? storage expansion / waste
CS 230 - Winter 2011 1-5 Examples 135 dec not too surprising... 1440 sep A32 hex use letters A...F to express digits > 9 5 10 0 + 3 10 1 + 1 10 2 = 135 0 7 0 + 4 7 1 + 4 7 2 + 1 7 3 = 567 2 16 0 + 3 16 1 + 10 16 2 = 2610

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-6 Conversion from Decimal repeatedly divide by target base remainders generate digits from right to left... example: 3219 dec = C93 hex 3219 / 16 = 201 R 3 201 / 16 = 12 R 9 12 / 16 = 0 R 12
CS 230 - Winter 2011 1-7 Binary Numbers only 0 and 1 as digits example 11101100 bin permits simple binary operations 2 2 + 2 3 + 2 5 + 2 6 + 2 7 = 236

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-8 Binary / Hex Conversion 0000 bin = 0 hex 0001 bin = 1 hex 0010 bin = 2 hex 0011 bin = 3 hex ... 1111 bin = F hex
CS 230 - Winter 2011 1-9 Binary Addition textbook procedure add digits right to left include carry-over fixed width n-bit representation: overflow modular arithmetic 4 bits: 14 + 4 = 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-10 Boolean Algebra algebra to express binary logic basic operators: OR, AND, NOT like normal elementary algebra addition – OR multiplication – AND negation – NOT identity, zero, inverse, commutative, associative models electronic circuits with relays
CS 230 - Winter 2011 1-11 Truth Tables and Gates OR X Y X + Y AND X Y X * Y NOT ¬X X Y Result 0 0 0 0 1 1 1 0 1 1 1 1 X Y Result 0 0 0 0 1 0 1 0 0 1 1 1 X Result 0 1 1 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-12 Other Rules Distributive Law A * (B + C) = A * B + A * C A (B C) = A B A C De Morgan's Law ¬ (A B) = ¬A ¬B ¬ (A B) = ¬A ¬B
CS 230 - Winter 2011 1-13 EXCLUSIVE OR XOR X Y X Y = (X ¬Y) (¬X Y) X Y = ¬(X Y) (X Y) X Y = (¬X ¬Y) (X Y) X Y Result 0 0 0 0 1 1 1 0 1 1 1 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-14 NOT AND NAND X | Y NAND is functionally complete (as is NOR) ¬X = X | X X Y = (X | Y) | (X | Y) X Y = (X | X) | (Y | Y) X Y Result 0 0 1 0 1 1 1 0 1 1 1 0
CS 230 - Winter 2011 1-15 2-Bit Addition Truth Table Sum = XOR Carry = AND A B Sum Carry 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-16 Half Adder combine XOR and AND gate S um and C arry S C B A
CS 230 - Winter 2011 1-17 2-Bit Addition with Carry multiple bits: need to include carry Truth Table A B Carry in Sum Carry out 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 230 - Winter 2011 1-18 2-Bit Addition with Carry Sum: 1 or 3 bits set
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 73

mod01 - CS 230 Introduction to Computers and Computer...

This preview shows document pages 1 - 19. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online