lecture3 - CIS 450 Computer Architecture and Organization...

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

View Full Document Right Arrow Icon
CIS 450 Computer Architecture and Organization Lecture 3: Integer Representation Mitch Neilsen Mitch Neilsen neilsen@ksu.edu neilsen@ksu.edu 219D Nichols Hall 219D Nichols Hall
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– Encoding Integers Encoding Integers z Sign + Magnitude Form Sign + Magnitude Form ± Complex arithmetic operations ± Two representations for 0, +0 and -0 z One One ’s Complement Form s Complement Form ± Compute negative value by complementing x: -x = ~x ± Simple arithmetic operations ± Still two representations for 0, +0 and -0 z Two Two ’s Complement Form s Complement Form ± Compute negative value by complementing and adding one: -x = ~x + 1 ± One representation for 0 ± More negative values than positive values (by one)
Background image of page 2
–3– Encoding Integers Encoding Integers short int x = 15213; short int y = -15213; ± C short 2 bytes long Sign Bit Sign Bit ± For 2’s complement, most significant bit indicates sign z 0 for nonnegative z 1 for negative B 2 T ( X ) =− x w 1 2 w 1 + x i 2 i i = 0 w 2 B 2 U ( X ) = x i 2 i i = 0 w 1 Unsigned Two’s Complement Sign Bit Decimal Hex Binary x 15213 3B 6D 00111011 01101101 y -15213 C4 93 11000100 10010011
Background image of page 3

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

View Full DocumentRight Arrow Icon
–4– Encoding Example (Cont.) Encoding Example (Cont.) x = 15213: 00111011 01101101 y = -15213: 11000100 10010011 Weight 15213 -15213 1 1 1 1 1 2 0 0 1 2 4 1 4 0 0 8 1 8 0 0 16 0 0 1 16 32 1 32 0 0 64 1 64 0 0 128 0 0 1 128 256 1 256 0 0 512 1 512 0 0 1024 0 0 1 1024 2048 1 2048 0 0 4096 1 4096 0 0 8192 1 8192 0 0 16384 0 0 1 16384 -32768 0 0 1 -32768 Sum 15213 -15213
Background image of page 4
–5– Numeric Ranges Numeric Ranges Unsigned Values Unsigned Values ± UMin =0 000…0 ± UMax = 2 w –1 111…1 Two Two ’s Complement Values s Complement Values ± TMin =– 2 w –1 100…0 ± TMax = 2 w –1 011…1 Other Values Other Values ± Minus 1 111…1 Decimal Hex Binary UMax 65535 FF FF 11111111 11111111 TMax 32767 7F FF 01111111 11111111 TMin -32768 80 00 10000000 00000000 -1 -1 FF FF 11111111 11111111 0 0 00 00 00000000 00000000 Values for W = 16
Background image of page 5

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

View Full DocumentRight Arrow Icon
–6– Values for Different Word Sizes Observations Observations ± | TMin | = TMax + 1 z Asymmetric range ± UMax =2 * TMax + 1 C Programming C Programming ± #include <limits.h> z K&R App. B11 ± Declares constants, e.g.,
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 21

lecture3 - CIS 450 Computer Architecture and Organization...

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

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