Number Systems and Arithmetic Jason Mars Thursday, January 24, 13 What do all those bits mean? bits (011011011100010 ....01) data instruction number text chars .............. R-format I-format ... integer floating point single precision double precision signed unsigned ... ... ... ... Thursday, January 24, 13 Questions About Numbers • How do you represent • negative numbers? • fractions? • really large numbers? • really small numbers? • How do you • do arithmetic? • identify errors (e.g. overflow)? • What is an ALU and what does it look like? • ALU=arithmetic logic unit Thursday, January 24, 13 Introduction to Binary Numbers • Consider a 4 bit binary number Decimal Binary Decimal Binary 0 0000 4 0100 1 0001 5 0101 2 0010 6 0110 3 0011 7 0111 • Examples of binary arithmetic 3 + 2 = 5 3 + 3 = 6 1 1 1 0 0 1 1 0 0 1 1 + 0 0 1 0 + 0 0 1 1 Thursday, January 24, 13 Introduction to Binary Numbers • Consider a 4 bit binary number Decimal Binary Decimal Binary 0 0000 4 0100 1 0001 5 0101 2 0010 6 0110 3 0011 7 0111 • Examples of binary arithmetic 3 + 2 = 5 3 + 3 = 6 1 1 1 0 0 1 1 0 0 1 1 + 0 0 1 0 + 0 0 1 1 1 Thursday, January 24, 13 Introduction to Binary Numbers • Consider a 4 bit binary number Decimal Binary Decimal Binary 0 0000 4 0100 1 0001 5 0101 2 0010 6 0110 3 0011 7 0111 • Examples of binary arithmetic 3 + 2 = 5 3 + 3 = 6 1 1 1 0 0 1 1 0 0 1 1 + 0 0 1 0 + 0 0 1 1 0 1 Thursday, January 24, 13 Introduction to Binary Numbers • Consider a 4 bit binary number Decimal Binary Decimal Binary 0 0000 4 0100 1 0001 5 0101 2 0010 6 0110 3 0011 7 0111 • Examples of binary arithmetic 3 + 2 = 5 3 + 3 = 6 1 1 1 0 0 1 1 0 0 1 1 + 0 0 1 0 + 0 0 1 1 1 0 1 Thursday, January 24, 13 Introduction to Binary Numbers • Consider a 4 bit binary number Decimal Binary Decimal Binary 0 0000 4 0100 1 0001 5 0101 2 0010 6 0110 3 0011 7 0111 • Examples of binary arithmetic 3 + 2 = 5 3 + 3 = 6 1 1 1 0 0 1 1 0 0 1 1 + 0 0 1 0 + 0 0 1 1 1 0 1 0 Thursday, January 24, 13 Introduction to Binary Numbers • Consider a 4 bit binary number Decimal Binary Decimal Binary 0 0000 4 0100 1 0001 5 0101 2 0010 6 0110 3 0011 7 0111 • Examples of binary arithmetic 3 + 2 = 5 3 + 3 = 6 1 1 1 0 0 1 1 0 0 1 1 + 0 0 1 0 + 0 0 1 1 1 0 1 1 0 Thursday, January 24, 13 Introduction to Binary Numbers • Consider a 4 bit binary number Decimal Binary Decimal Binary 0 0000 4 0100 1 0001 5 0101 2 0010 6 0110 3 0011 7 0111 • Examples of binary arithmetic 3 + 2 = 5 3 + 3 = 6 1 1 1 0 0 1 1 0 0 1 1 + 0 0 1 0 + 0 0 1 1 1 0 1 1 1 0 Thursday, January 24, 13
Description: