Lecture3 - INFO-1003 Introduction to Computer Systems...

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

View Full Document Right Arrow Icon
INFO-1003 - Lecture 3 1 Copyright Richard Neville 2007 INFO-1003 Introduction to Computer Systems Dr Richard Neville [email protected] Room: 1.6 Lamb Building, Booth street East Week 3
Background image of page 1

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

View Full DocumentRight Arrow Icon
INFO-1003 - Lecture 3 2 Copyright Richard Neville 2007 Q3 1. Question What is the 11010 2 in radix 10? ANSWER(S): a) 26 10 . 2. Question a) How is the largest 5-bit binary number calculated? – give equation. b) What is the largest 5-bit binary number? c) What is the decimal equivalent of the largest 5-bit binary number? ANSWER(S): a) For any number base x for positive integers of n digits the range is from: 0 to x n – 1, or [0, x n – 1] e.g. x n – 1 = 2 5 – 1 = 32 -1 = 31; a) 11111 2 ; b) 11111 2 = 1×2 4 + 1×2 3 + 1×2 2 + 1×2 1 + 1×2 0 = 1×16 + 1×8 + 1×4 + 1×2 + 1×1 = 31. Question Convert the number 17 (decimal) to an unsigned binary byte? – using sequential division by 2. c ANSWER(S): 2 )117 c 2 )17 R = 1 c 2 ) 8 R = 0 Result = 10001 binary c 2 ) 2 R = 0 c 2 ) 1 R = 0 c 0 R = 1 NOTE: In the exam approximately 2 question are taken from the topics (and program examples) coved in each lecture
Background image of page 2
INFO-1003 - Lecture 3 3 Copyright Richard Neville 2007 Lecture 3: Binary Arithmetic (1) Addition and Subtraction with signed and unsigned integers
Background image of page 3

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

View Full DocumentRight Arrow Icon
INFO-1003 - Lecture 3 4 Copyright Richard Neville 2007 Learning Outcomes 1 c To be able to perform calculations like: c Binary Addition; c Addition with 2’s complement numbers; c Addition Applied to Signed Integers; c Subtraction;
Background image of page 4
INFO-1003 - Lecture 3 5 Copyright Richard Neville 2007 Binary Addition c The following rules apply c 0 + 0 = 0 (carry 0) c 0 + 1 = 1 (carry 0) c 1 + 0 = 1 (carry 0) c 1 + 1 = 0 (carry 1) ___ Re. , available at the end of the lecture notes.
Background image of page 5

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

View Full DocumentRight Arrow Icon
INFO-1003 - Lecture 3 6 Copyright Richard Neville 2007 Addition Applied to Unsigned (i.e. Positive) Integers (Example 1) c Using positive (unsigned) integers add the following pair of bytes together c 00000101 2 (5 10 ) c 00001100 2 (12 10 ) 00000101 + 00001100 00010001 11 b carry Result = 00010001 2 = 17 10
Background image of page 6
INFO-1003 - Lecture 3 7 Copyright Richard Neville 2007 Addition Applied to Unsigned (i.e. Positive) Integers (Example 2) c Using positive (unsigned) integers add the following pair of bytes together c 11111111 2 (255 10 ) c 00000010 2 (2 10 ) c Looking at the first binary integer, we can see that we might meet a problem c As noted in Lecture 2, 255 10 is the largest number we represent in an unsigned byte, we should find problems when we do the addition c Next slide
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Copyright Richard Neville 2007 Addition Applied to Positive Integers (Example 2) 11111111 + 00000010 100000001 1111111 b carry This appears to give the correct answer (2 8— 1)+2 1 =255 10 +2 10 =257 10 , but the result is 9 bits, we are adding bytes (8 bits) to produce a byte therefore the leftmost bit must be discarded. This gives the result 00000001
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2008 for the course COMP 17021 taught by Professor Dr.richardneville during the Fall '08 term at University of Manchester.

Page1 / 94

Lecture3 - INFO-1003 Introduction to Computer Systems...

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

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