mod01 - CS 230 - Winter 2011 1-1 CS 230 Introduction to...

Info iconThis preview shows pages 1–17. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 230 - Winter 2011 1-1 CS 230 Introduction to Computers and Computer Systems Module 1 Arithmetic, Hardware, Data Martin Karsten mkarsten@cs.uwaterloo.ca 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 n 1 d i r i 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 + 3 10 1 + 1 10 2 = 135 7 + 4 7 1 + 4 7 2 + 1 7 3 = 567 2 16 + 3 16 1 + 10 16 2 = 2610 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 = 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 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 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 1 1 1 1 1 1 1 X Y Result 1 1 1 1 1 X Result 1 1 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 1 1 1 1 1 1 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 1 1 1 1 1 1 1 CS 230 - Winter 2011 1-15 2-Bit Addition Truth Table Sum = XOR Carry = AND A B Sum Carry 1 1 1 1 1 1 1 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...
View Full Document

This note was uploaded on 09/28/2011 for the course CS 230 taught by Professor Bb during the Spring '11 term at Waterloo.

Page1 / 73

mod01 - CS 230 - Winter 2011 1-1 CS 230 Introduction to...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online