CompOrg Fall 2002 Lecture Notes: Data Representation and Integer Arithmetic

Data Representation and Integer Arithmetic

8/29/02, 9/5/02

References:

Chapter 2, sections 2.1-2.3



Bits, Bytes and Words
ASCII
Binary, Decimal and Hexadecimal
Positional Notation
Converting from decimal to hex, hex to decimal
printf and various representations
Memory
Addressing
Words
Byte ordering
little endian vs. big endian
C program (fig 2.3) to print byte representation
Byte representation for various values
Strings (C/C++)
Pointers (C/C++)
Boolean Algebra
Operations: AND, OR, NOT
Properties (fig 2.7)
Operations on bit vectors, C operators
XOR useful properties
Shift operations (and C programming of)
Integer Representation
unsigned
signed representations that are not used much
sign and magnitude
ones' complement
two's complement - the representation used in most computers
negation of a two's complement number
signed vs. unsigned ints and C programming
casting
sign extension
truncation
Integer Arithmetic
unsigned addition
Overflow
Two's Complement addition
Unsigned multiplication
Signed Multiplication
Special Case: multiplication by powers of 2
Computer Organization Fall 2002