lecture_02 - ECE 190 Lecture 02 January 20, 2011 1 V....

Info iconThis preview shows pages 1–4. 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
This is the end of the preview. Sign up to access the rest of the 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 Floating-point 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 Signed-magnitude 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 3-bit 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 signed-magnitude , 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 1s complement Another way to represent both positive and negative integers, called 1s 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 1s 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 2s complement The schema that is actually used in todays computers is called 2s complement Positive numbers are represented in a straightforward way, with leading digit set to 0 o With k bits, 2 k-1-1 positive numbers (from 1 to 2 k-1-1) 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 1s complement...
View Full Document

Page1 / 11

lecture_02 - ECE 190 Lecture 02 January 20, 2011 1 V....

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

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