This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: ECE 190 Lecture 02 January 20, 2011 1 V. Kindratenko Bits and Operations on Bits Lecture Topics Unsigned and signed integer representations Conversion between binary and decimal representations Arithmetic and logical operations on binary numbers Floatingpoint data representation Other representations Lecture materials Textbook Chapter 2 Homework Posted on the course website (http://courses.engr.illinois.edu/ece190/) Due Wednesday January 26 at 5pm in the ECE190 drop box located in the basement of Everitt Lab ECE 190 Lecture 02 January 20, 2011 2 V. Kindratenko Unsigned and signed integer representations Signedmagnitude So far we defined a way to write positive (unsigned) integer numbers using 0 and 1 bits, but how about writing negative numbers? o We can use half of the distinct patterns made of k bits to represent positive values and the other half to represent negative values Example: with 3 bits we can represent integer numbers from 3 to +3; this leaves us with one 3bit code not assigned We still need to decide what distinct patterns we should use for representing positive numbers vs. negative numbers o One way, called signedmagnitude , is to use the leading digit to indicate if the number is positive or negative Positive numbers will have 0 as the leading digit Negative numbers will have 1 as the leading digit Binary notation Signed magnitude 000 0 001 1 010 2 011 3 100 0 101 1 110 2 111 3 The largest positive number is this example is 011 2 =3 10 The smallest negative number in this notation is 111 2 =3 10 We still are not using one representation efficiently: 100 2 1’s complement Another way to represent both positive and negative integers, called 1’s complement , is based on the idea that all negative numbers can be represented by flipping digits in the positive numbers o Example: 010 2 =2 10 . 101 2 =2 10 o In this case, we still are not using one representation efficiently: 111 2 o This representation was actually used in some early computers, e.g., CDC 6600 Binary notation Signed magnitude 1’s complement 000 0 0 001 1 1 010 2 2 011 3 3 100 0 3 101 1 2 110 2 1 111 3 0 ECE 190 Lecture 02 January 20, 2011 3 V. Kindratenko 2’s complement The schema that is actually used in today’s computers is called 2’s complement Positive numbers are represented in a straightforward way, with leading digit set to 0 o With k bits, 2 k11 positive numbers (from 1 to 2 k11) can be represented this way The negative integers are represented by counting backward and wrapping around o Example: 111 2 =1 10 , 110 2 =2 10 ,… o The default rule is that all negative numbers have a leading bit set to 1 Negative numbers are defined in such a way that when added to the positive numbers with the same magnitude, 0 is obtained o This makes implementing digital logic particularly simpler than using any other binary representation Binary notation Signed magnitude 1’s complement...
View
Full
Document
This note was uploaded on 08/24/2011 for the course ECE 190 taught by Professor Hutchinson during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Hutchinson

Click to edit the document details