Engin112-F07-L05-codes

Engin112-F07-L05-codes - Engin112 Lecture 5 Number Codes...

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

View Full Document Right Arrow Icon
1 Tilman Wolf Department of Electrical and Computer Engineering 9/14/07 Engin112 – Lecture 5 Number Codes and Registers Engin112 – 9/14/07 2 Recap From Last Lecture ± Arithmetic with binary numbers y Addition y Subtraction y Multiplication ± Signed numbers y Signed Magnitude y Complement representation » Radix complement » Diminished radix complement ± Today: codes for non-numeric information
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Engin112 – 9/14/07 3 Binary Codes ± Most data on computers are not numbers y Data is still encoded with 0’s and 1’s ± Need codes for y Text characters y Floating point numbers y Images y Programs y ± “An n-bit binary code is a group of n bits that assume up to 2 n distinct combinations of 1’s and 0’s, with each combination representing one element of the set that is being coded.” Engin112 – 9/14/07 4 Binary Codes ± Example: coding of compass directions: E, W, N, S y 2-bit code can assume 2 2 =4 combinations y Code: 00 <–> E, 01 <–> W, 10 <–> N, 11 <–> S ± Is this the only possible code? y Other 2-bit codes (24 possible solutions) y Other n-bit codes (n>2, infinitely many solutions) y E.g.: 0001 <–> E, 0010 <–> W, 0100 <–> N, 1000 <–> S ± Observations y Each element must be assigned at least one unique binary bit combination y Not all binary bit combinations need to have an element assigned
Background image of page 2
3 Engin112 – 9/14/07 5 BCD Code ± Some (old) computers code numbers in decimals y “Binary Coded Digits” y Each 4-bit binary sequence encodes one base-10 digit ± Sanity check: y Does each element of the coded set have a unique bit sequence assigned? y Are there any invalid/unassigned bit sequences ± Decimal numbers are coded as multiple BCD digits y E.g., (396) 10 = (0011 1001 0110) BCD y How many bits would it take in binary? 1001
Background image of page 3

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

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

Page1 / 10

Engin112-F07-L05-codes - Engin112 Lecture 5 Number Codes...

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